You are viewing a single comment's thread. Return to all comments →
#include<stdio.h> #include<stdlib.h> int main() { int i,n,sum=0; scanf("%d", &n); int *arr = (int *)malloc(n * sizeof(int)); for(i=0;i<n;i++) scanf("%d", (arr+i)); for(i=0;i<n;i++) sum = sum + *(arr+i); 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 →