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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

646


What are the usage of pointer in c?

701


What is typedef?

663


What are the advantages of using linked list for tree construction?

639


Why can't I perform arithmetic on a void* pointer?

635






Is c call by value?

599


What is the heap?

681


Can we use any name in place of argv and argc as command line arguments?

606


Where register variables are stored in c?

544


How can I read in an object file and jump to locations in it?

573


Which of these functions is safer to use : fgets(), gets()? Why?

631


Why main function is special give two reasons?

940


Explain what is dynamic data structure?

642


What is 2c dna?

602


Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent

1644