大家帮忙看看我这个为什么不对,我想用它来求最大公约数
大家帮忙看看我这个为什么不对,我想用它来求最大公约数int number1,number2,temp,gcd;
if(number1==0)gcd=number2;
if(number2==0)gcd=number1;
else
{if(number1>number2){
while(number2!=0){temp=number2;
number2=number1/number2;
number1=temp;}gcd=number1;}
else
{while(number1!=0){temp=number1;
number1=number2/number1;
number2=temp;}gcd=number2;}}
[ 本帖最后由 记锝天箜狠蓝 于 2012-12-28 23:36 编辑 ]