Advertisement
Josif_tepe

Untitled

Oct 17th, 2021
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4. bool rec(int number) {
  5.     if(number < 10) {
  6.         return 1;
  7.     }
  8.     int last_digit = number % 10;
  9.     int last_to_last_digit = (number / 10) % 10;
  10.     if(last_digit < last_to_last_digit) {
  11.         return rec(number / 10);
  12.     }
  13.     return 0;
  14. }
  15. int main()
  16. {
  17.     int number;
  18.     cin >> number;
  19.     cout << rec(number) << endl;
  20.     return 0;
  21. }
  22.  
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement