Ilija123

Domaci Zadatak 4.

Jan 23rd, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2. main()
  3. {
  4.    
  5.     int br, a, b, c, pom;
  6.  
  7.     printf("Unesite trocifreni broj: \n");
  8.     printf("\tBroj : ");
  9.     scanf("%d", &broj);
  10.  
  11.     a=broj/100 ;
  12.     b=(broj%100)/10 ;
  13.     c=broj%10 ;
  14.  
  15.     if (a<b)
  16.         pom=a;
  17.         a=b;
  18.         b=pom;
  19.  
  20.     if (a<c)
  21.         pom=a;
  22.         a=c;
  23.         c=pom;
  24.  
  25.     if (b<c)
  26.         pom=b;
  27.         b=c;
  28.         c=pom;
  29.  
  30.     broj=a*100+b*10+c;
  31.  
  32.     printf("Najveci trocifreni broj je -> %d\n", broj);
  33.     getch();
  34. }
Add Comment
Please, Sign In to add comment