其算法過程為:前提:設兩數為a,b設其中a 做被除數,b做除數,temp為余數
1、大數放a中、小數放b中;
2、求a/b的余數;
3、若temp=0則b為最大公約數;
4、如果temp!=0則把b的值給a、temp的值給b;
5、返回第第二步;
#include#include void main(){ int divisor(int a,int b); int multiple(int a,int b); printf("The highest common divisor is %d \n",divisor(15,9)); printf("The lowest common multiple is %d \n",multiple(15,9)); } int divisor(int a,int b){ int temp; if(a