#include
//求最大公约数
void GreatestCommonDivisor()
{
while (1)
{
int m = 0,n = 0;
printf("input m:\b");
scanf("%d",&m);
getchar();
printf("input n:\b");
scanf("%d",&n);
if (m == 0 || n == 0) return;
if (m n) n :m;
int c = 0;
while ((a % b) != 0)
{
c = a % b;
a = b;
b = c;
}
printf("%d and %d GreatestCommonDivisor = %d\n",m,n,b);
printf("%d and %d 最小公倍数为:%d\n",m,n,b/n);
}
}
int main()
{
GreatestCommonDivisor();
return 0;
}
.输入两个正整数m和n,求其最大公约数和最小公倍数.这个程序怎么编啊?
.输入两个正整数m和n,求其最大公约数和最小公倍数.这个程序怎么编啊?
输入两个正整数m和n,求其最大公约数和最小公倍数.这个程序怎么编啊?
输入两个正整数m和n,求其最大公约数和最小公倍数.这个程序怎么编啊?
其他人气:492 ℃时间:2019-11-13 18:35:05
优质解答
我来回答
类似推荐
猜你喜欢
- 1已知点D、E分别在△ABC的边AB和AC上,DE//BC,△ABC的面积为S,BC=a,△ADE的面积为S1,求DE的长.
- 2空间四边形ABCD中,E,F,G,H分别在AB,BC,CD,DA上,AE:EB=AH:HD=m,CF:FB=CG:GD=n
- 3Where is the gym?It is in a b__ in front of the offices
- 4I____this jacket any more A:don't need B:needn't C:need D:not need
- 52乙烷气体中混有少量的乙炔怎么除去化学方程式
- 6( )the news ,she let out a cry of joy.which of the following is wrong.A.to hear.B.when she heard
- 71000里既不是2的倍数,又不是3的倍数,又不是5的倍数的数有几个?
- 8介词短语在句中的成分
- 9工业制镁一般是用什么方法啊?为什么说“工业上制镁一般是电解氯化镁,而不是氧化镁是”是错的?
- 10已知:如图,在△ABC中,CD⊥AB垂足为D,BE⊥AC垂足为E,连接DE,点G、F分别是BC、DE的中点. 求证:GF⊥DE.