C program to find factorial of number given by the user.
Here is the code for finding the factors of a given number :
Output:
Enter a number whose factorial you want: 5
120
Output:
Enter a number whose factorial you want: 5
120
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
//C program to find factor of a number | |
#include<stdio.h> | |
void main() | |
{ | |
int i,number,f=1; | |
printf("Enter number whose factorial you want :\t"); | |
scanf("%d",&number); | |
for(i=1;i<=number;i++) | |
{ | |
f=f*i; | |
} | |
printf("Factorial is :\t%d",f); | |
} |
Comments
Post a Comment
Feel free to leave a comment...