题解 | #最大公约数#
最大公约数
https://www.nowcoder.com/practice/20216f2c84bc438eb5ef05e382536fd3
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int GCD(int number1, int number2)
{
int mod = number1 % number2;
if (mod == 0)
{
return number2;
}
else
{
return GCD(number2,mod);
}
}
int main()
{
int number1, number2;
while (cin >> number1 >> number2)
{
cout << GCD(number1, number2);
}
/*cin >> number1 >> number2;*/
}
360集团公司氛围 407人发布
查看21道真题和解析