#include <stdio.h>
int main()
{
int n, i, num, sum = 0;
printf("How many numbers? ");
scanf("%d", &n);
for(i=0; i<n; ++i)
{
printf("Enter number %d: ", i+1);
scanf("%d", &num);
sum += num;
}
printf("Sum of the numbers is %d.\n", sum);
return 0;
}
Comments
Leave a comment