Write a program to find the factorial of a given number
#include<stdio.h>
#include<conio.h>
void main()
{
int n,fact=1,i;
clrscr();
printf("Enter the number: ");
scanf("%d",&n);
for(i=1;i<=n;i++)
fact=fact*i;
printf("%d!=%d",n,fact);
getch();
}
Output:
Enter the number: 5
5!=120
No comments: