counter

Free Hit Counter

C program to find factorial

Q: program to find the factorial value of any number entered through the keyboard.


#include
#include
void main()
{
int i=1,num,fact=1;
clrscr();
printf("enter any number: ");
scanf("%d",&num);
while(i<=num)
{
fact=fact*i;
i++;
}
printf("\tfactorial=%d",fact);
getch();
}

No comments:

Post a Comment