Josif_tepe

Untitled

Aug 26th, 2026
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4. #include <math.h>
  5.  
  6. int sum(int n, int * niza) {
  7.     int zbir = 0;
  8.     for(int i = 0; i < n; i++) {
  9.         zbir += niza[i];
  10.     }
  11.     return zbir;
  12. }
  13.  
  14. int main(int argc, char * argv[]) {
  15.     int n;
  16.     scanf("%d", &n);
  17.  
  18.     int niza[n];
  19.     for(int i = 0; i < n; i++) {
  20.         scanf("%d", &niza[i]);
  21.     }
  22.  
  23.     int z = sum(n, niza);
  24.  
  25.     printf("%d\n", z);
  26.  
  27. }
  28.  
  29.  
  30.  
  31.  
Advertisement
Add Comment
Please, Sign In to add comment