Friday, September 30, 2011

Factorial of a number using c


#include<stdio.h>
void main()
{
int i,n,fact=1;
clrscr();
printf("Enter the number : ");
scanf("%d",&n);
for(i=1;i<=n;i++)
 {
  fact=fact*i;
 }
  printf("%d",fact);
getch();
}

0 comments:

Post a Comment