Skip to content

Instantly share code, notes, and snippets.

@psych0der
Created September 24, 2013 16:05
Show Gist options
  • Save psych0der/6687093 to your computer and use it in GitHub Desktop.
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 .....
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