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