/* package whatever; // don't place package name! */
import java.util.* ;
import java.lang.* ;
import java.io.* ;
/* Name of the class has to be "Main" only if the class is public. */
class Lab8
{
static boolean multiplo3( int n) {
return n % 3 == 0 ;
}
{
Scanner leer
= new Scanner
( System .
in ) ;
System .
out .
print ( "Introduce el primer número entero: " ) ; int numero1 = leer.nextInt ( ) ;
verificarMultiplo( numero1) ;
System .
out .
print ( "Introduce el segundo número entero: " ) ; int numero2 = leer.nextInt ( ) ;
verificarMultiplo( numero2) ;
System .
out .
print ( "Introduce el tercer número entero: " ) ; int numero3 = leer.nextInt ( ) ;
verificarMultiplo( numero3) ;
System .
out .
print ( "Introduce el cuarto número entero: " ) ; int numero4 = leer.nextInt ( ) ;
verificarMultiplo( numero4) ;
System .
out .
print ( "Introduce el quinto número entero: " ) ; int numero5 = leer.nextInt ( ) ;
verificarMultiplo( numero5) ;
}
static void verificarMultiplo( int numero) {
if ( multiplo3( numero) ) {
if ( numero % 3 == 0 ) {
System .
out .
println ( "El número " + numero
+ " es múltiplo de 3 y es par." ) ; } else {
System .
out .
println ( "El número " + numero
+ " es múltiplo de 3 pero no es par." ) ; }
} else {
System .
out .
println ( "El número " + numero
+ " no es múltiplo de 3." ) ; }
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgTGFiOAp7CglzdGF0aWMgYm9vbGVhbiBtdWx0aXBsbzMoaW50IG4pIHsKCQlyZXR1cm4gbiAlIDMgPT0gMDsKCX0KCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJIFNjYW5uZXIgbGVlciA9IG5ldyBTY2FubmVyKFN5c3RlbS5pbik7CgogICAgICAgIAogICAgICAgIFN5c3RlbS5vdXQucHJpbnQoIkludHJvZHVjZSBlbCBwcmltZXIgbsO6bWVybyBlbnRlcm86ICIpOwogICAgICAgIGludCBudW1lcm8xID0gbGVlci5uZXh0SW50KCk7CiAgICAgICAgdmVyaWZpY2FyTXVsdGlwbG8obnVtZXJvMSk7CiAgICAgICAgIAoKICAgICAgICAKICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCJJbnRyb2R1Y2UgZWwgc2VndW5kbyBuw7ptZXJvIGVudGVybzogIik7CiAgICAgICAgaW50IG51bWVybzIgPSBsZWVyLm5leHRJbnQoKTsKICAgICAgICB2ZXJpZmljYXJNdWx0aXBsbyhudW1lcm8yKTsKICAgICAgICAgCgogICAgICAgICAKICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCJJbnRyb2R1Y2UgZWwgdGVyY2VyIG7Dum1lcm8gZW50ZXJvOiAiKTsKICAgICAgICBpbnQgbnVtZXJvMyA9IGxlZXIubmV4dEludCgpOwogICAgICAgIHZlcmlmaWNhck11bHRpcGxvKG51bWVybzMpOwogICAgICAgICAKCiAgICAgICAKICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCJJbnRyb2R1Y2UgZWwgY3VhcnRvIG7Dum1lcm8gZW50ZXJvOiAiKTsKICAgICAgICBpbnQgbnVtZXJvNCA9IGxlZXIubmV4dEludCgpOwogICAgICAgIHZlcmlmaWNhck11bHRpcGxvKG51bWVybzQpOwoKICAgICAgICAKICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCJJbnRyb2R1Y2UgZWwgcXVpbnRvIG7Dum1lcm8gZW50ZXJvOiAiKTsKICAgICAgICBpbnQgbnVtZXJvNSA9IGxlZXIubmV4dEludCgpOwogICAgICAgIHZlcmlmaWNhck11bHRpcGxvKG51bWVybzUpOwogICAgICAgICAKICAgICAgICAgCiAgIAogICAgfQoKICAKICAgIHN0YXRpYyB2b2lkIHZlcmlmaWNhck11bHRpcGxvKGludCBudW1lcm8pIHsKICAgIGlmIChtdWx0aXBsbzMobnVtZXJvKSkgewogICAgaWYgKG51bWVybyAlIDMgPT0gMCkgewogICAgU3lzdGVtLm91dC5wcmludGxuKCJFbCBuw7ptZXJvICIgKyBudW1lcm8gKyAiIGVzIG3Dumx0aXBsbyBkZSAzIHkgZXMgcGFyLiIpOwogICAgfSBlbHNlIHsKICAgU3lzdGVtLm91dC5wcmludGxuKCJFbCBuw7ptZXJvICIgKyBudW1lcm8gKyAiIGVzIG3Dumx0aXBsbyBkZSAzIHBlcm8gbm8gZXMgcGFyLiIpOwogICAgfQogICB9IGVsc2UgewogICBTeXN0ZW0ub3V0LnByaW50bG4oIkVsIG7Dum1lcm8gIiArIG51bWVybyArICIgbm8gZXMgbcO6bHRpcGxvIGRlIDMuIik7CiAgIH0KICAgIH0KfQo=