// Write a program to find the sum of an array of 10 Numbers
// Write a program to find the sum
of an array of 10 Numbers
Write a program in C to enter 10 digits in 1d array and display the total sum of those digits...
In this program, we will take 10 values by the user and we will return the sum of the values which user have Entered by using a one-dimensional array
#include<stdio.h>
#include<conio.h>
void main ()
{
int a[10],i,s=0;
clrscr();
printf("Enter 10
numbers\n");
for(i=0;i<10;i++)
scanf("%d",&a[i]);
for(i=0;i<10;i++)
s=s+a[i];
printf("sum is %d",s);
getch();
}
OUTPUT:-
Enter 10 numbers
10 9 8 7 6 5 4 3 2 1
sum is 55
Comments
Post a Comment