Write A Program To Find Factorial Of Given Number Using Recursive Function
Write A Program To Find Factorial Of Given Number Using Recursive Function
M3-R4 O-Level Jan-20 Subjective Programming Based Question 8 (A)
PART-1
Note: To read about
M3 R4 O-Level Jan-20 MCQ
https://learncomputerpci.blogspot.com/2020/07/m3-r4-o-level-jan-20-mcq-with-answers.html
M3 R4 O-Level Jan-20 TRUE OR FALSE
https://learncomputerpci.blogspot.com/2020/07/m3-r4-o-leveljan-20-true-or-false-m3.html
M3 R4 O-Level Jan-20 MATCH THE FOLLOWING
https://learncomputerpci.blogspot.com/2020/07/m3-r4-o-leveljan-20-match-following-m3.html
M3 R4 O-Level Jan-20 FILL IN THE BLANKS
https://learncomputerpci.blogspot.com/2020/07/m3-r4-o-level-jan-20-fill-in-blanks.html
/*Write a program to find factorial of given number using recursive function*/
#include<stdio.h>
#include<conio.h>
int fact(int); /* Function Prototype */
void main()
{
int num,res;
clrscr();
printf("Enter a
number");
scanf("%d",&num);
res=fact(num); /*Function Calling */
printf("Factorial of %d is %d",num,res);
getch();
}
int fact(int n) /*Function Definition */
{
if(n==1)
return 1; /*
Terminating Step */
else
return n*fact(n-1);
/*Recursive step */