Advertisement
Josif_tepe

Untitled

Oct 6th, 2021
158
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 <cmath>
  3. #include <algorithm>
  4. #include <vector>
  5. using namespace std;
  6.  
  7. void print(int x) {
  8.     if(x > 10) {
  9.         return;
  10.     }
  11.    
  12.     cout << x << endl;
  13.     print(x + 1);
  14. }
  15. int main() {
  16.     print(1);
  17.     return 0;
  18. }
  19. // print(1)
  20. // print(2)
  21. // print(3)
  22. // print(4)
  23. // print(5)
  24. // print(6)
  25. // print(7)
  26. // print(8)
  27. // print(9)
  28. // print(10)
  29. // print(11) --> return / end of recursion
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement