Advertisement
Josif_tepe

Untitled

Apr 13th, 2025
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. void print(int x) {
  6.     if(x > 5) {
  7.         return;
  8.     }
  9.    
  10.     print(x + 1);
  11.     cout << x << endl;
  12. }
  13. int main() {
  14.     print(1);
  15.    
  16.     return 0;
  17. }
  18. // print(1) --> print(2) | cout << 1;
  19. // print(2) --> print(3) | cout << 2;
  20. // print(3) --> print(4) | cout << 3;
  21. // print(4) --> print(5) | cout << 4;
  22. // print(5) --> print(6) | cout << 5;
  23. // print(6)
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement