Recursion in C++

A Recursive function call itself again and again until base case . Base case is that condition in which our recursion function terminate.

Source Code

#include<iostream>
using namespace std;
void recursion(int lep)
{
  int b=6;
  if(lep>b)   
  return;
  else{
  cout<<" LEP Recursion Tutorial # : "<<lep<<endl;
  recursion(lep=lep+1); 
 }
}
 int main(){
 int start =1;
 recursion(start); 
 return 0;
}

Output of the Program

Recursion in C++

Share on Google Plus

About Asad

Asad Niazi is Software Engineer , Programmer, Web Developer and a young mentor of BloggersTown and PProgramming. Asad Love to writes about Technology, Programming, Blogging and make money online.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment