fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes here
  5. int n;
  6. printf("enter a number::");
  7. scanf("%d",&n);
  8. int fac=1;
  9. for(int i=1 ;i<=n;i++){
  10. fac=fac*i;
  11. }
  12. printf("factorial is :%d",fac);
  13. return 0;
  14.  
  15. }
  16.  
Success #stdin #stdout 0s 5276KB
stdin
5
stdout
enter a number::factorial is :120