This file contains hidden or 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> | |
int facto(int f) | |
{ | |
int fact = 1; | |
for(;f>0;f--) | |
{ | |
fact=fact*f; | |
} | |
return fact; | |
} | |
int main() | |
{ | |
int n,fact; | |
printf("Enter the number to find the factorial: "); | |
scanf("%d",&n); | |
fact = facto(n); | |
printf("The factorial of %d is %d ",n,fact); | |
getch(); | |
return(0); | |
} |
Comments
Post a Comment