For this we have to know what factorial is:
For example the factorial of 5 is 5*4*3*2*1
The main source code of this programme is given below:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<conio.h> | |
int main() | |
{ | |
int n,i,fact; | |
printf("enter the num whose factorial is to be find"); | |
scanf("%d",&n); | |
fact=1; | |
for(i=n;i>=1;i--) | |
{ | |
fact=fact*i; | |
} | |
printf("factorial of the entered number=%d",fact); | |
getch(); | |
} |
0 comments :
Post a Comment