write a program that finds the factorial of a number using
recursion?
Answer Posted / anandi
#include<stdio.h>
#include<conio.h>
void main()
{
int factorial(int);
int n;
clrscr();
printf("Enter a number: ");
scanf("%d",&n);
printf("Factorial of %d is: %d",n,factorial(n));
getch();
}
int factorial(int f)
{
int fact;
if(f==1)
return(1);
else
fact=f*factorial(f-1);
return(fact);
}
| Is This Answer Correct ? | 197 Yes | 32 No |
Post New Answer View All Answers
What does c mean in standard form?
how can f be used for both float and double arguments in printf? Are not they different types?
which is an algorithm for sorting in a growing Lexicographic order
When should a type cast not be used?
What are the 4 types of functions?
Explain what are the __date__ and __time__ preprocessor commands?
What's the right way to use errno?
What is a far pointer in c?
Is stack a keyword in c?
How do I round numbers?
What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?
a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler
a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above
Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.
Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?