TO FIND FACTORIAL OF A NUMBER
void main()
{
int i=1,f=1,num;
clrscr();
printf("\nEnter a number:");
scanf("%d",&num);
while(i<=num)
{
f=f*i;
i++;
}
printf("\nFactorial of %d is:%d",num,f);
getch();
}
No comments:
Post a Comment