fork(1) download
  1.  
  2. #include <stdio.h>
  3. int main(void)
  4. {
  5. int i, n;
  6. long p=1;
  7. printf("Please enter n:");
  8. scanf("%d", &n);
  9. for (i=1; i<=n; i++)
  10. {
  11. p=p*i;
  12. }
  13. printf("%d! = %ld\n", n, p); /* 以长整型格式输出n的阶乘值 */
  14. return 0;
  15. }
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
Please enter n:32766! = 0