write a program that finds the factorial of a number using
recursion?
Answer Posted / inderjeet
#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 ? | 62 Yes | 18 No |
Post New Answer View All Answers
Is c high or low level?
What is the scope of an external variable in c?
Can you define which header file to include at compile time?
pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)
Can a program have two main functions?
What is the right type to use for boolean values in c?
What are the c keywords?
What does dm mean sexually?
What is binary tree in c?
What is a ternary operator in c?
How do I determine whether a character is numeric, alphabetic, and so on?
What does the file stdio.h contain?
List the different types of c tokens?
In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?
What is type qualifiers?