Basic Programs
If Else based Programs
Loop Based Programs
Array Based Programs
String Programs
Function Programs
Pointers Programs
Structure & File Handling Programs
Data Structure Programs
Function based programs
Factorial program using recursion
#include<stdio.h> #include<conio.h>
void main() {
int n=0,f=0;
printf("enter the number");
scanf("%d",&n);
f=fact(n);
printf("factorial of %d is %d",n,f);
}
int fact(int n)
{
if(n==1)
return 1;
else
return(n*fact(n-1));
}
Output of the above program is as following.
Video/ C Introduction
Watch video in full size