c program to manipulate x=1!+2!+3!+...+n! using recursion
Answer / 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 |
What is break statement?
Write a program to print distinct words in an input along with their count in input in decreasing order of their count
What is c mainly used for?
What is far pointer in c?
prototype of sine function.
Can one function call another?
A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers
which one is highest Priority in c? a)=,b)+,c)++,d)==
Differentiate between calloc and malloc.
which header file contains main() function in c?
17 Answers Google, HCL, TCS,
which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;
How does sizeof know array size?