fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int n,fact=1;
  5. printf("enter a integer:");
  6. scanf("%d",&n);
  7. for (int i=1;i<=n;i++){
  8. fact=fact*i;
  9. }
  10. printf("factorial of a number=%d\n",fact);
  11. return 0;
  12. }
  13.  
Success #stdin #stdout 0s 5324KB
stdin
1
stdout
enter a integer:factorial of a number=1