Computer Science, asked by priyankajangid7785, 9 months ago

Algorithm for sum of n numbers by using arrays

Answers

Answered by niveshsanjaygarg
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