Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

c program to manipulate x=1!+2!+3!+...+n! using recursion

Answer Posted / satya

#include<stdio.h>
#include<conio.h>
int sumfact(int n)
{ int cnt=0,out;
if(cnt==0)
out=1;
if(n==1)
return out;
else
{
int i,fact=1;
for(i=n;i>=2;i--)

fact*=i;
out+=fact;
cnt++;

return out+sumfact(n-1);
}
}
main()
{
int out,n;
clrscr();
printf("Enter the vlue of n ");
scanf("%d",&n);
out=sumfact(n);
printf("%d",out);
getch();
}

Is This Answer Correct ?    6 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define Array of pointers.

1048


How can you tell whether two strings are the same?

1206


Write a program that accept anumber in words

1712


main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }

1096


i got 75% in all semester am i eligible for your company

2173


What is the difference between far and near in c?

999


What is typedef struct in c?

1003


How can I change the size of the dynamically allocated array?

1098


Can true be a variable name in c?

990


how to write optimum code to divide a 50 digit number with a 25 digit number??

3209


What is the difference between a function and a method in c?

1037


What is the advantage of an array over individual variables?

1190


What is indirection? How many levels of pointers can you have?

1093


What is the difference between fread and fwrite function?

1035


Why we write conio h in c?

967