write a program that finds the factorial of a number using
recursion?
Answer Posted / meenakshi
#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 ? | 17 Yes | 8 No |
Post New Answer View All Answers
Do you know null pointer?
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.
How do you use a pointer to a function?
What are the different types of endless loops?
What are the advantages of the functions?
What are categories used for in c?
What is 1d array in c?
What is size of union in c?
What is a void pointer in c?
What are the 5 elements of structure?
Explain what is wrong in this statement?
Can the size of an array be declared at runtime?
Write a progarm to find the length of string using switch case?
An application package has been provided to you without any documents for the following application. The application needs to be tested. How will you proceed?
Explain what is meant by high-order and low-order bytes?