Advertisement
STANAANDREY

fjyfuy

Mar 3rd, 2020
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int isSorted(int x, int u)
  5. {
  6.     x /= 10;
  7.     if (x < 100 && x <= u)
  8.         return 1;
  9.  
  10.     if ((x % 10) > u)
  11.         return 0;
  12.     return isSorted(x, x % 10);
  13. }
  14.  
  15. int main()
  16. {
  17.     int x;
  18.     cin >> x;
  19.     cout << isSorted(x, x % 10);
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement