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...


Write a program to compute the following
1!+2!+...n!

Answers were Sorted based on User's Feedback



Write a program to compute the following 1!+2!+...n!..

Answer / fhghg

#include<stdio.h>
int n_fact(int n);
void main()
{
int n,res=0;
printf("ENTER A NUMBER:-");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
res+=n_fact(n);
}
printf("%d",res);
}
int n_fact(n)
{
int result;
if(n=0)
result=1;
else
result=n*n_fact(n-1);
return(result);
}

Is This Answer Correct ?    8 Yes 2 No

Write a program to compute the following 1!+2!+...n!..

Answer / vignesh1988i

#include<stdio.h>
#include<conio.h>
long factorial(int,long);
void main()
{
int i,m;
long sum=0,k=1;
clrscr();
printf("enter ur no. of terms :");
scanf("%d",&m);
i=1;
while(i<=m)
{
k=factorial(i,k);
sum+=k;
i++;
}
printf("the sum is : %ld",sum);
getch();
}
int factorial(int i,long k)
{
return (i*k);
}

hope this also correct...
thank u

Is This Answer Correct ?    3 Yes 0 No

Write a program to compute the following 1!+2!+...n!..

Answer / yamuna

/* A.Yamuna III BSC CS L.R.G. College , Tirupur*/
#include<stdio.h>
#include<conio.h>
void main()
{
int a,n;
int sum=1;
int total=0;
clrscr();
printf("Enter the number :");
scanf("%d",&n);
for(a=1;a<=n;a++)
{
for(int i=1;i<=a;i++)
{
sum=sum*i;
}
total=total+sum;
sum=1;
}
printf("The factorial is :%d",total);
getch();
}

Is This Answer Correct ?    0 Yes 0 No

Write a program to compute the following 1!+2!+...n!..

Answer / ashish

#include<stdio.h>
int n_fact(int n);
void main()
{
int n,res;
printf("ENTER A NUMBER:-");
scanf("%d",&n);
res=n_fact(n);
printf("%d",res);
}
int n_fact(n)
{
int result;
if(n=0)
result=1;
else
result=n*n_fact(n-1);
return(result);
}

Is This Answer Correct ?    5 Yes 6 No

Post New Answer

More C Interview Questions

How to find a missed value, if you want to store 100 values in a 99 sized array?

0 Answers   Honeywell, Zomato,


Explain the term printf() and scanf() used in c language?

0 Answers  


Write a program to print distinct words in an input along with their count in input in decreasing order of their count..

1 Answers  


What is static identifier?

0 Answers   TCS,


write a program to create a sparse matrix using dynamic memory allocation.

0 Answers  


C program to read the integer and calculate sum and average using single dimensional array

0 Answers  


Is null always defined as 0(zero)?

0 Answers  


what is the use of ~ in c lang?????

3 Answers  


How will you divide two numbers in a MACRO?

0 Answers   Apps Associates,


Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.

0 Answers   TCS,


for(i=1;i>0;i++); printf("i=%d",i); what will be the answer????

7 Answers  


Why is a semicolon (;) put at the end of every program statement?

0 Answers  


Categories