最大公约数,最小公倍数计算
int n,m,r,x,y;
double p;
scanf("%d %d",&n,&m);
x = n;
y = m;
r = n % m;
while®{
n = m;
m = r;
r = n % m;
}
p = x * y / m;
printf("%d %lf",m,p);
return 0;
}
input:1000000 1000000
调试里面显示p溢出????
double类型在计算机里不是占8个字节,64位么,除去符号位,2的63次方一共是9.2e+18啊,不可能溢出啊,求解