Friday, 19 August 2011

Factorial of Number Using While Loop

#nclude <stdio.h>
#include <conio.h>
void main()
{
int i=1,n,fact=1;
clrscr();
printf("enter a number");
scanf("%d",&n);
while(i<=n)
{
fact=fact*i;
printf("%d",i);
i++;
}
printf("fact=%d",fact);
getch();
}

No comments:

Post a Comment