Advertisement
Josif_tepe

Untitled

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