write a program that finds the factorial of a number using
recursion?
Answer Posted / asit kumar swain
#include<stdio.h>
#include<conio.h>
int fact(int);
void main()
{
int num,fact1;
clrscr();
printf("Enter a value of num");
scanf("%d",&num);
fact1=fact(num);
printf("factorial=%d",fact1);
}
int fact(int n)
{
if(n==0)
{
return 1;
}
else
{
return n*fact(n-1);
}
}
| Is This Answer Correct ? | 27 Yes | 13 No |
Post New Answer View All Answers
Why do we need volatile in c?
Write a program to print fibonacci series without using recursion?
How do you define structure?
what does static variable mean?
which type of aspect you want from the student.
What is nested structure?
Implement bit Array in C.
When should I declare a function?
What is a macro, and explain how do you use it?
Why is c known as a mother language?
What happens if header file is included twice?
What is the Purpose of 'extern' keyword in a function declaration?
Why main is not a keyword in c?
how can i access hard disk address(physical address)? are we access hard disk by using far,near or huge pointer? if yes then please explain.....
Write a program to check prime number in c programming?