Advertisement
ebx

drugi_kolokvijum_d_poredak

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