Summation

mail@pastecode.io avatar
unknown
c_cpp
2 months ago
369 B
2
Indexable
Never
#include <stdio.h>

int main() {
  int N;
  int summation = 0;

  printf("Inpur Arrat Size: ");
  scanf("%d", &N);
  int array[N];

  printf("Inpur Arrat Elements: ");
  for (int i = 0; i < N; i++) {
    scanf("%d", &array[i]);
  }

  for (int i = 0; i < N; i++) {
    summation = summation + array[i];
  }

  printf("Summationan Result: %d", summation);

  return 0;
}
Leave a Comment