Advertisement
Josif_tepe

Untitled

Mar 27th, 2022
872
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <queue>
  3. #include <algorithm>
  4. #include <vector>
  5. #include <algorithm>
  6. #include <set>
  7. #include <cstring>
  8. #include <cmath>
  9. #include <map>
  10. #include <fstream>
  11. using namespace std;
  12.  
  13. void f(int x) {
  14.     if(x > 10) {
  15.         return;
  16.     }
  17.     f(x + 1);
  18.     cout << x << " ";
  19. }
  20. int main() {
  21.  
  22.     f(1);
  23.    return 0;
  24. }
  25. /*
  26.  f(1) --> f(2)  | cout << 1 << " ";
  27.  f(2) --> f(3)  | cout << 2 << " ";
  28.  f(3) --> f(4)  | cout << 3 << " ";
  29.  f(4) --> f(5)  | cout << 4 << " ";
  30.  f(5) --> f(6)  | cout << 5 << " ";
  31.  f(6) --> f(7)  | cout << 6 << " ";
  32.  f(7) --> f(8)  | cout << 7 << " ";
  33.  f(8) --> f(9)  | cout << 8 << " ";
  34.  f(9) --> f(10) | cout << 9 << " ";
  35.  f(10) --> f(11)| cout << 10 << " ";
  36.  f(11) --> return
  37.  
  38.  */
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement