Welcome to my blog this is test

28 June 2012

write a C program to find the factorial of a given no


//Code:
#include
#include
 void main()
  {
   int i,j,fact=1;
   clrscr();
   printf("\n Enter the value of i = ");
    scanf("%d",&i);
      for(j=1;j<=i;j++)
            fact=fact*j;
   printf("\n The factorial of the given no is = %d",fact);
   getch();
  }

/*Output:
Enter the value of i = 5
The factorial of the given no is = 120



No comments:

Post a Comment