Anda di halaman 1dari 1

package problema3;

import javax.swing.JOptionPane;

public class Problema3


{
public static void main(String[] args)
{
String numero1,numero2;
int a,b,n1,n2,mcd;

numero1=JOptionPane.showInputDialog("Ingrese el primer numero");


numero2=JOptionPane.showInputDialog("Ingrese el segundo numero");
a=Integer.parseInt(numero1);
b=Integer.parseInt(numero2);

do
{if(a>b)
{a=a-b;
}
else
{b=b-a;
}
}
while(a!=b);
mcd=b;
JOptionPane.showMessageDialog(null,"El MCD es: "+mcd);

Anda mungkin juga menyukai