-
Lenguaje
Java usando BufferedReader
-
Descripción
Permitir leer dos números N1 y N2 e indicar si uno de los dos divide exactamente al otro, en caso contrario informar que no es posible.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import java.io.*;
public class DivisionExactaDeN1YN2 {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int N1, N2;
System.out.print("Ingresa el valor de N1: ");
N1 = Integer.parseInt(in.readLine());
System.out.print("Ingresa el valor de N2: ");
N2 = Integer.parseInt(in.readLine());
if(N1%N2==0||N2%N1==0)
System.out.println("Uno de los dos divide exactamente al otro.");
else
System.out.println("No es posible.");
in.close();
}
}
public class DivisionExactaDeN1YN2 {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int N1, N2;
System.out.print("Ingresa el valor de N1: ");
N1 = Integer.parseInt(in.readLine());
System.out.print("Ingresa el valor de N2: ");
N2 = Integer.parseInt(in.readLine());
if(N1%N2==0||N2%N1==0)
System.out.println("Uno de los dos divide exactamente al otro.");
else
System.out.println("No es posible.");
in.close();
}
}