• + 0 comments

    int main() { int n; scanf("%d", &n);

    const unsigned int SIZE = n;
    int* p = malloc(SIZE * sizeof(int));
    if (!p) { exit(1); }
    
    int sum = 0;
    
    for (int i = 0; i < SIZE; ++i) {
        scanf("%d", p + i);
        sum += p[i];
    }
    printf("%d\n", sum);
    
    free(p);
    p = NULL;
    
    return 0;
    

    }