title: Print star using recursion
body: <p>to print pattern</p>
  <pre><code>*****
  ****
  ***
  **
  *
  </code></pre>
  <p>this is correct ans</p>
  <pre><code>void recur1(int n, int i){
      //base case
      if(n==0)
          return;
  
      if(i==n){
          cout&lt;&lt;endl;
          recur1(n-1,0);
      }
       else{
           cout&lt;&lt;&quot;*&quot;;
           recur1(n,i+1);
      }
  }
  </code></pre>
  <p>but I did it like this</p>
  <pre><code>void recur1(int n, int i){
      //base case
      if(n==0)
          return;
  
      if(i==n){
          cout&lt;&lt;endl;
          recur1(n-1,0);
      }
  
      cout&lt;&lt;&quot;*&quot;;
      recur1(n,i+1);
  }
  </code></pre>
  <p>why we want to put recursive case in else condition, what is happening if i dont use else as it is showing segmentation fault code dump error</p>