Advertisement
Anik_Akash

Recursion Practice ১.১

Feb 13th, 2021
525
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 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==0)return;
  7.    
  8.     seris(s-1, e);
  9.     printf("%d ", s);
  10.    
  11. }
  12.  
  13. int main()
  14. {
  15.     int n, t;
  16.     cin>>n;
  17.     t = n;
  18.    
  19.     while (t--)
  20.     {
  21.         if(t==n-1)
  22.         {
  23.             seris(n,1);  
  24.             printf("\n");
  25.         }
  26.         else {
  27.             n-=1;
  28.              seris(n,1);  
  29.              printf("\n");
  30.         }
  31.     }
  32.       return 0;
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement