#include <stdio.h>
int main()
{
int n, sum = 0, c, array[100];
printf("Enter the number of integers you want to add\n");
scanf("%d", &n);
printf("Enter %d integers\n", n);
for (c = 0; c < n; c++)
{
scanf("%d", &array[c]);
sum = sum + array[c];
}
printf("Sum = %d\n", sum);
return 0;
}
Enter the number of integers you want to add
3
Enter 3 integers
3 4 2
Sum = 9
No comments:
Post a Comment