Advertisement
sellmmaahh

OR-tut4-zad3.5

Aug 6th, 2015
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. int main()
  4. {
  5.     int broj,i=2;
  6.     printf("Unesite broj: ");
  7.     scanf("%d", &broj);
  8.     if (broj<=0) {
  9.             printf("Broj nije prirodan.");
  10.     return 0;
  11.     }
  12.     if (broj==1) {
  13.             printf("Broj nije ni prost ni slozen.");
  14.     return 0;
  15.     }
  16.     while(i<broj) {
  17.             if (broj%i==0) {printf("Broj je slozen.");   return 0; }
  18.             i++;
  19.  
  20.  
  21.     }
  22.     printf("Broj je prost.");
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement