Anik_Akash

Recursion Practice

Feb 13th, 2021 (edited)
598
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace    std;
  3.  
  4. void seris(int s, int e)
  5. {
  6.     if(s>e)return;
  7.     printf("%d ", s);
  8.     seris(s+1, e);
  9.     printf("\n");
  10.     seris(1, e-1);
  11. }
  12.  
  13. int main()
  14. {
  15.    #ifndef Brain_FUCK
  16.         freopen("input.txt","r",stdin);
  17.         freopen("out.txt","w",stdout);
  18.     #endif
  19.    
  20.     int n;
  21.     cin>>n;
  22.     seris(1,n);  
  23.     return 0;
  24. }
  25.  
  26.  
Add Comment
Please, Sign In to add comment