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