Advertisement
ebx

drugi_kolokvijum_c_faktori

ebx
May 4th, 2012
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main (int argc, char** argv) {
  4.     int broj, p=2;
  5.     printf("broj: ");
  6.     scanf("%d", &broj);
  7.     if (broj < 0) broj = -broj;
  8.     if (broj == 0) return 0;
  9.     printf("1");
  10.     while(broj>1) {
  11.         if (broj%p == 0) {
  12.             printf("*%d", p);
  13.             broj /= p;
  14.         }
  15.         else
  16.             p++;
  17.     }
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement