用F10后发现程序走到scanf那里就不走了,为什么?
#define _CRT_SECURE_NO_WARNINGS
#include
int main()
{
int a, b, x, y, temp;
scanf("%d%d", &x, &y);
if (x < num2)
temp = x, x = y, y = temp;
a = x, b = y;
while (b != 0);
{
temp = a % b;
a = b;
b = temp;
}
printf("最大公约数为%d", a);
printf("最小公倍数为%d", x * y / a);
return 0;
}
你的num2都没有定义和初始化,你拿输入的x和一个不知道是啥的num2在比较,肯定比不了呀