Advertisement
Josif_tepe

Untitled

Nov 16th, 2021
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. void rec(int i) {
  5.     if(i == 51) {
  6.         return;
  7.     }
  8.     rec(i + 1);
  9.     if(i % 2 == 0) {
  10.         cout << i << " ";
  11.     }
  12. }
  13. int main()
  14. {
  15.     rec(1);
  16.     return 0;
  17. }
  18. /*
  19.  rec(1)
  20.  rec(2) --> cout << 2 << endl;
  21.  rec(3)
  22.  rec(4) --> cout << 4 << endl;
  23.  rec(5)
  24.  rec(6) --> cout << 6 << endl;
  25.  rec(7)
  26.  rec(8) --> cout << 8 << endl;
  27.  rec(9)
  28.  rec(10) --> cout << 10 << endl;
  29.  rec(11)
  30.  **/
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement