-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathejercicio5.java
More file actions
45 lines (27 loc) · 866 Bytes
/
ejercicio5.java
File metadata and controls
45 lines (27 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.edu.introduccion.introduccion_java_boletinII;
import java.util.Scanner;
public class ejercicio5 {
/*
5. Realizar un método llamado esMultiplo que recibirá dos números y devuelva True si
el primer número es múltiplo del segundo.
*/
public static void main(String[] args) {
int numeroA;
int numeroB;
Scanner sc= new Scanner(System.in);
System.out.println("Introduce un numero ");
numeroA= sc.nextInt();
System.out.println("Introduce otro número ");
numeroB= sc.nextInt();
System.out.println(esmultiplo(numeroA,numeroB));
}
public static boolean esmultiplo(int numeroA, int numeroB) {
boolean mensaje = false;
if (numeroA > 0 && numeroB>0) {
if (numeroA%numeroB==0) {
mensaje=true;
}
}
return mensaje;
}
}