Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
499 B
5
Indexable
Never

#include <iostream>

/// em chi dc go phan noi dung trong nay, include va main la wecode quy dinh

int TongUocChung(int a, int b)
{
    int sum = 0;
    for (int i = 1; i <= a; i++)
    {
        if ((a % i == 0) && (b % i == 0)) 
            sum = sum + i;
    }
    return sum;
}
int input()
{
    int a;
    std::cin >> a;
    return a;
}
void input(int b)
{
    std::cin >> b;
}

////

int main(){
    int a, b;
    a=input();
    input(b);
    std::cout << TongUocChung(a, b);
    return 0;
}