#include <iostream>
using namespace std;
int main() {
int a, b;
cout << "Ingresa el primer número entero positivo: ";
cin >> a;
cout << "Ingresa el segundo número entero positivo: ";
cin >> b;
if (a <= 0 || b <= 0) {
cout << "Por favor, ingresa números enteros positivos." << endl;
return 1;
}
while (b != 0) {
int temp = b;
b = a % b;
a = temp;
}
cout << "El Máximo Común Divisor (MCD) es: " << a << endl;
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: