Int main () { Int I, s=1; For (I=1; i <21. I++) S *=I; Printf (" % d ", s); return 0; }
CodePudding user response:
Recursive #include #include
Int fac (int n) { If (n & lt; =1){ return 1; } The else { Fac return n * (n - 1); }
} Int main () { int n=0; Printf (" please enter a number: "); Scanf_s (" % d ", & amp; N);//the input you find such as the product of the above 20 Int fac (n); Printf (" % d \ n ", fac (n)); system("pause"); return 0; }
CodePudding user response:
LS two methods can, but the result is beyond the scope int, so it's best to change the int type double