Advertisement
Josif_tepe

Untitled

Nov 12th, 2023
684
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 <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5. #include <math.h>
  6.  
  7. int rek(int broj) {
  8.     if(broj < 10) {
  9.         return 1;
  10.     }
  11.    
  12.     int posledna = broj  % 10;
  13.     int pretposledna = (broj / 10) % 10;
  14.    
  15.     if(pretposledna >= posledna) {
  16.         return 0;
  17.     }
  18.     return rek(broj / 10);
  19. }
  20. int main(int argc, char * argv[]) {
  21.     int n;
  22.     scanf("%d", &n);
  23.     printf("%d\n", rek(n));
  24.     return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement