Está en la página 1de 1

package javaapplication8; import java.io.

*; public class JavaApplication8 { public static void main(String[] args) { int A=0,B=0,con=0,a, mcd=0; BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); try { System.out.println("Ingrese el valor de A:"); A=Integer.parseInt(in.readLine()); System.out.println("Ingrese el valor de B:"); B=Integer.parseInt(in.readLine()); } catch(Exception e) { System.out.println("ERROR"); } if(A<B) { a=A; } else if (B<A){ a=B; } else { a=B; } for(int x=1; x<=a; x++){ if(A % x == 0 & B % x == 0){ mcd=x; } } System.out.println("m.c.d es "+mcd) ; if(mcd>10){ con=1; } } }

También podría gustarte