Write a C program to find factorial of a given number

 GTU Programming for Problem Solving Practical-17 

/*

17. Write a C program to find factorial of a given number. 

*/

#include <stdio.h>

int main()

{

 int no,fact=1;

 printf("\n Enter No to find its Factorial : ");

 scanf("%d",&no);

 while(no>1)

 {

  fact=fact*no;

  no=no-1;

 }

 printf("\n Factorial of entered no is : %d",fact);

 return 0;

}

Post a Comment

0 Comments