123456789101112131415161718 |
- #include <stdio.h>
- int sum(int n, int *arr) {
- int sum = 0, i;
- for(i = 0; i < n; i++) sum += *(arr + i);
- return sum;
- }
- int main() {
- int n,i;
- scanf("%d",&n);
-
- int arr[n];
- for (i = 0; i < n; i++) scanf("%d",&arr[i]);
- printf("%d",sum(n, arr));
-
- return 0;
- }
|