Created
September 24, 2013 16:05
-
-
Save psych0der/6687093 to your computer and use it in GitHub Desktop.
recursive solution to series : 1+2*4 + 3*5*7 + 4*6*8*10 .....
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int level,sol; //level of recusrsion | |
printf("Enter the level\n"); | |
scanf("%d",&level); | |
sol = solve(1); | |
int solve(int n) | |
{ | |
int temp=1; | |
for(int i=1;i<n+1;i++) | |
{ | |
temp*=(n+ i*2); | |
} | |
if(n==level) | |
return temp; | |
return temp + solve(n+1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment