/* Factorial of a number using for loop */
#include<stdio.h>
#include<conio.h>
void main()
{
int num,i,fact=1;
printf("Enter a Number:");
scanf("%d",&num);
for(i=1;i<=num;i++)
{
fact=fact*i;
}
printf("%d!=%d",num,fact);
}
0 comments:
Post a Comment