fork download
  1. #include <iostream>
  2. using namespace std;
  3. void rec1(int i, int n){
  4. if(i>n)
  5. return;
  6. cout<<i<<endl;
  7. rec1(i+1, n);
  8. }
  9. int main() {
  10. int n;
  11. cin>>n;
  12. rec1(1,n);
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0.01s 5288KB
stdin
10
stdout
1
2
3
4
5
6
7
8
9
10