English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

都以三個數來說如何求大小,名次,公因數,總分
可以的話寫出來的程式可以幫我在旁邊寫一下敘述嗎
4個題目可以分開來寫

我有找過 不過不知道是不適用的軟體的關係 我看不懂別人寫的答案

2006-06-25 05:45:59 · 1 個解答 · 發問者 XX 1 in 電腦與網際網路 程式設計

1 個解答

int fun_gcd(int n1st,int n2nd){//while
int num_3rd=1;
int num1st=n1st;
int num2nd=n2nd;
while(num_3rd!=0){ //輾轉相除法
num_3rd=num1st%num2nd;
num1st=num2nd;
num2nd=num_3rd;
}
return num1st; //回傳最大公因數
}

2006-06-27 11:43:50 補充:
int ret_small(int n1st,int n2nd){ int small_number; if(n1st
2006-06-27 11:47:28 補充:
void main(){int fun_gcd(int,int);int ret_small(int,int);int nNum[3],ngcd[3];printf("Input 3 number\nFirst: ");scanf("%d",&nNum[0]);printf("Second: ");scanf("%d",&nNum[1]);printf("Third: ");scanf("%d",&nNum[2]);//未完……

2006-06-27 11:49:40 補充:
//接上方… ngcd[0]=fun_gcd(nNum[0],nNum[1]); ngcd[1]=fun_gcd(nNum[1],nNum[2]); ngcd[2]=fun_gcd(nNum[2],nNum[0]); printf("GCD: %d\n",ret_small(ret_small(ngcd[0],ngcd[1]),ret_small(ngcd[1],ngcd[2]))); printf("Sum: %d\n",nNum[0]+nNum[1]+nNum[2]);} //主程式結束

2006-06-27 07:43:02 · answer #1 · answered by Big_John-tw 7 · 0 0

fedest.com, questions and answers