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.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4. void rec(int number) {
  5.     if(number == 0) {
  6.         return;
  7.     }
  8.     int last_digit = number % 10;
  9.     if(last_digit == 9) {
  10.         last_digit = 7;
  11.     }
  12.     rec(number / 10);
  13.     cout << last_digit;
  14. }
  15. int main()
  16. {
  17.     int number;
  18.     cin >> number;
  19.     rec(number);
  20.     cout << endl;
  21.     return 0;
  22. }
  23.  
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement