recursive call in c++ code example
Example: recursion in c++
//AUTHOR:praveen
//Function calling itself
//Example in c++
#include<iostream>
using namespace std;
int recursion(int a){
if(a==1)//BASE CASE
return 0;
cout<<a;
a=a-1;
return recursion(a);//FUNCTION CALLING ITSELF
}
int main(){
int a=5;
recursion(a);
return 0;
}
//OUTPUT: 5 4 3 2