Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
447 B
3
Indexable
Never
#include <iostream>

int euclideanGCD(int a, int b) {
    while (b != 0) {
        int temp = b;
        b = a % b;
        a = temp;
    }
    return a;
}

int main() {
    int num1, num2;
    std::cout << "Nhap hai so nguyen duong: ";
    std::cin >> num1 >> num2;

    int gcd = euclideanGCD(num1, num2);
    std::cout << "Uoc chung lon nhat cua " << num1 << " va " << num2 << " la: " << gcd << std::endl;

    return 0;
}