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
Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
What are the usage of pointer in c?
What is typedef?
What are the advantages of using linked list for tree construction?
Why can't I perform arithmetic on a void* pointer?
Is c call by value?
What is the heap?
Can we use any name in place of argv and argc as command line arguments?
Where register variables are stored in c?
How can I read in an object file and jump to locations in it?
Which of these functions is safer to use : fgets(), gets()? Why?
Why main function is special give two reasons?
Explain what is dynamic data structure?
What is 2c dna?
Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent