#include <stdio.h> #include <stdlib.h> int cal(int *array, int n) { int cnt = 0; for(int i = 0; i < n; i++) { cnt += *(array+i); } return cnt; } int main() { int n; int result; while (scanf("%d", &n) != EOF) { int *array = (int*)malloc(sizeof(int) * n); for(int i = 0; i < n; i++) { scanf("%d",(array + i)); } result = cal(array, n); free(array); } printf("%d", result); return 0; }