用for循環(huán)求10的階乘 C語言,求n階乘的代碼?
C語言,求n階乘的代碼?#包含“stdio。H“int main(){int n,I,s=1scanf(%d”,&n)for(I=1I<=Ni)//for循環(huán)累加s=s*Iprintf(%d
C語言,求n階乘的代碼?
#包含“stdio。H“
int main(){
int n,I,s=1
scanf(%d”,&n)
for(I=1I<=Ni)//for循環(huán)累加
s=s*I
printf(%dn“,s)
return 0
}]/*
③直到I超過n。
輸入5,相應的階乘輸出如下;
5!=120.000000
輸入20,對應的階乘輸出如下:
2020!= 2432902008176640000.000000