Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int g_c_d(int a, int b) {
- if (a == b) {
- return a;
- }
- return a > b ? g_c_d(a - b, b) : g_c_d(a, b - a);
- }
- int main() {
- setlocale(LC_ALL, "ru");
- cout << g_c_d(3, 8) << endl;
- cout << g_c_d(25, 125) << endl;
- cout << g_c_d(6, 9) << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement