Josif_tepe

Untitled

Aug 26th, 2026
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 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 broj) {
  7.     int deliteli = 0;
  8.     for(int i = 1; i <= broj; i++) {
  9.         if(broj % i == 0) {
  10.             deliteli++;
  11.         }
  12.     }
  13.  
  14.     if(deliteli > 2) {
  15.         return -1;
  16.     }
  17.     else {
  18.         return 1;
  19.     }
  20. }
  21.  
  22. int main(int argc, char * argv[]) {
  23.     int x;
  24.     scanf("%d", &x);
  25.  
  26.     int p = funkcija(x);
  27.  
  28.     printf("%d\n", p);
  29.  
  30. }
  31.  
  32.  
  33.  
  34.  
Advertisement
Add Comment
Please, Sign In to add comment