//Program to find out Factorial of given number
#include<stdio.h>
#include<conio.h>
int main()
{
int n,j,k;
clrscr();
printf("Enter a number whose factorial you want to calculate\n");
scanf("%d",&n);
k=n;
for(j=1;j<k;j++)
{
n=j*n;
}
printf("Factrorial of the %d is = %d",k,n);
getch();
return 0;
}
To Run this Program Copy it in text editor and save as .c
Then double click on it and then it will get opened in your compiler.
Click on run.
#include<stdio.h>
#include<conio.h>
int main()
{
int n,j,k;
clrscr();
printf("Enter a number whose factorial you want to calculate\n");
scanf("%d",&n);
k=n;
for(j=1;j<k;j++)
{
n=j*n;
}
printf("Factrorial of the %d is = %d",k,n);
getch();
return 0;
}
To Run this Program Copy it in text editor and save as .c
Then double click on it and then it will get opened in your compiler.
Click on run.
Good Job By Admin....
ReplyDeleteI find one more easiest way to write
C Program To Find Factorial Of The Given Number by using single while loop