In this C-program we will calculate the sum upto 'N' numbers using array. The numbers will be taken from the user.color>
input:
'N' numbers.(i.e : 9,56,548)output:
The sum of the given numbers will be printed on the screen.CODE---->
#include
#include
{
int arr[50],i,n,sum=0;
printf(" How many numbers you want to enter ?\n color>");
scanf("%dcolor>",&n);
printf(" Please,Enter the numbers : color>");
for(i=0color>;i
{
scanf("%dcolor>",&arr[i]);
}
for(i=0color>;i
{
sum=sum+arr[i];
}
printf("\n The sum of the given numbers is : %d\ncolor>",sum);
system("pausecolor>");
}
color>