第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

為什么 n 為20 階乘為負數(shù)

? ?#include<stdio.h>

? int prodict(int n){

? int ss;

? if(n < 0){

? printf("輸入錯誤!");

? return 0;

? }

? if(n == 1 || n == 0){

?return 1;

? }

?else {

?ss = prodict(n-1) * n;

?}

? return ss;

?}

?int main() {

?printf("n=%d: %d\n", 1, prodict(1));

?printf("n=%d: %d\n", 2, prodict(2));

?printf("n=%d: %d\n", 3, prodict(3));

?printf("n=%d: %d\n", 4, prodict(4));

?printf("n=%d: %d\n", 5, prodict(5));

?printf("n=%d: %d\n", 6, prodict(6));

?printf("n=%d: %d\n", 7, prodict(7));

?printf("n=%d: %d\n", 7, prodict(8));

?printf("n=%d: %d\n", 9, prodict(9));

?printf("n=%d: %d\n", 10, prodict(10));

?printf("n=%d: %d\n", 20, prodict(20));

?printf("n=%d: %d\n", 30, prodict(30));

?printf("n=%d: %d\n", 50, prodict(50));

?return 0;

?}


運算結(jié)果:

n=1: 1

n=2: 2

n=3: 6

n=4: 24

n=5: 120

n=6: 720

n=7: 5040

n=7: 40320

n=9: 362880

n=10: 3628800

n=20: -2102132736

n=30: 1409286144

n=50: 0



正在回答

1 回答

超界??紤]int型范圍在-32768~32767,用實型更妥當

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

為什么 n 為20 階乘為負數(shù)

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號