plz answer..... a program that reads non-negative integer
and computes and prints its factorial
Answer Posted / valli
//using recursion
fact(int);
main()
{
int n;
printf("enter n");
scanf("%d",n)
if(n<0)
printf("invalid number");
else
printf("factorial of %d =%d",n,fact(n));
}
fact(int n)
{
if(n==0||n==1)
return 1;
else
return n*fact(n-1);
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What does static variable mean in c?
Is there anything like an ifdef for typedefs?
Is there any possibility to create customized header file with c programming language?
What is the use of getchar() function?
writ a program to compare using strcmp VIVA and viva with its output.
Which programming language is best for getting job 2020?
in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above
What is scope and lifetime of a variable in c?
What is a function simple definition?
What standard functions are available to manipulate strings?
Is it possible to execute code even after the program exits the main() function?
What is function prototype in c language?
Why is main function so important?
What are the 5 data types?
How do you construct an increment statement or decrement statement in C?