-
Lenguaje
Java usando Scanner
-
Descripción
Se ingresan dos números enteros, averiguar si son múltiplos entre si.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import java.util.Scanner;
public class MultiplosEntreSi {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a, b;
System.out.print("Ingresa el valor de a: ");
a = in.nextInt();
in.nextLine();
System.out.print("Ingresa el valor de b: ");
b = in.nextInt();
in.nextLine();
if(a%b==0||b%a==0)
System.out.println("Los n\u00FAmeros son m\u00FAltiplos.");
else
System.out.println("Los n\u00FAmeros no son m\u00FAltiplos.");
}
}
public class MultiplosEntreSi {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a, b;
System.out.print("Ingresa el valor de a: ");
a = in.nextInt();
in.nextLine();
System.out.print("Ingresa el valor de b: ");
b = in.nextInt();
in.nextLine();
if(a%b==0||b%a==0)
System.out.println("Los n\u00FAmeros son m\u00FAltiplos.");
else
System.out.println("Los n\u00FAmeros no son m\u00FAltiplos.");
}
}