You are viewing a single comment's thread. Return to all comments →
#include<stdio.h> #include<stdlib.h> int main() { int n; scanf("%d", &n); int *arr; arr = (int *) malloc(n * sizeof(int)); for(int i=0; i<n; i++) { scanf("%d", &arr[i]); } int sum = 0; for(int j=0; j<n; j++) { sum = sum + arr[j]; } free(arr); printf("%d\n", sum); return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
1D Arrays in C
You are viewing a single comment's thread. Return to all comments →
For C