fork download
  1. #include <stdio.h>
  2. int main() {
  3. int i,j,a[2048],N=200;
  4. //初始化陣列內容
  5. memset(a,0,sizeof(a));
  6. a[0]=1;
  7. for (i=1 ; i<=N ; i++) { //i 從 1 ~ 200 代表 1x2x3...x200
  8. //從最低位數開始計算新的結果
  9. for (j=0 ; j < sizeof(a)/sizeof(a[0]) ; j++) {
  10. a[j] *= i;
  11. }
  12. //處理數字進位
  13. for (j=0 ; j < sizeof(a)/sizeof(a[0])-1 ; j++) {
  14. a[j+1] += a[j]/10;
  15. a[j] %= 10;
  16. }
  17. }
  18. //準備列印出結果
  19. for (i=sizeof(a)/sizeof(a[0])-1 ; i >=0 ; i--) {
  20. if (a[i] != 0) break;
  21. }
  22. //印出計算完成的結果
  23. for ( ; i>=0 ; i--) {
  24. printf("%d",a[i]);
  25.  
  26. }
  27. system("pause");
  28. }
  29.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
cc1: warnings being treated as errors
prog.c: In function ‘main’:
prog.c:5: error: implicit declaration of function ‘memset’
prog.c:5: error: incompatible implicit declaration of built-in function ‘memset’
prog.c:27: error: implicit declaration of function ‘system’
stdout
Standard output is empty