1. #include<stdio.h>  
  2. main()    
  3. {    
  4.  int i,fact=1,n;    
  5.  printf(“Enter a number: “);    
  6.   scanf(“%d”,&n);    
  7.     for(i=1;i<=n;i++)
  8. {    
  9.       fact=fact*i;    
  10.   }    
  11.   printf(“Factorial of %d is: %d”,n, nfact);    
  12. }   
  13. output:
  14. Enter a number: 5 Factorial of 5 is: 120

Leave a Reply

Your email address will not be published. Required fields are marked *