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
Explain what are header files and explain what are its uses in c programming?
write a program to reverse a every alternetive words in a string in a place. EX: Input is "this is the line of text" Output should be "shit is eht line fo text" Please any one tell me code for that.
What's the best way of making my program efficient?
What is a macro in c preprocessor?
write a program to print largest number of each row of a 2D array
What's the difference between constant char *p and char * constant p?
What are the advantages of the functions?
How can I implement sets or arrays of bits?
int i=10; printf("%d %d %d", i, i=20, i);
What are the types of c language?
What are the types of pointers?
What are the output(s) for the following ? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye")} main() { char *f(); printf("%c",*f()='A'); }
List the difference between a "copy constructor" and a "assignment operator"?
How can I trap or ignore keyboard interrupts like control-c?
Write a function that will take in a phone number and output all possible alphabetical combinations