Algorithm for sum of n numbers by using arrays
Answers
Answered by
0
Answer:
C program to calculate sum of n numbers using an array
- int main() { int n, sum = 0, c, array[100];
- scanf("%d", &n);
- for (c = 0; c < n; c++) { scanf("%d", &array[c]); sum = sum + array[c]; }
- printf("Sum = %d\n", sum);
- return 0; }
Similar questions