Advertisement
Josif_tepe

Untitled

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