📄 wex10_11.cpp
字号:
#include <iostream.h>
#pragma hdrstop
// recursively computes the GCD of m and n
int gcd(int a, int b)
{
int remainder = a % b;
if (remainder == 0)
return b;
else
return gcd(b,remainder);
}
void main(void)
{
int a, b;
cout << "Enter a and b: ";
cin >> a >> b;
cout << "Greatest common divisor of " << a << " and "
<< b << " is " << gcd(a,b) << endl;
}
/*
<Run>
Enter a and b: 45 155
Greatest common divisor of 45 and 155 is 5
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -