-
Lenguaje
Java usando Scanner
-
Descripción
Lea un número y determinar si termina en 4.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import java.util.Scanner;
public class NumeroTerminaEn4 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int un_numero;
System.out.print("Ingresa el valor de un numero: ");
un_numero = in.nextInt();
in.nextLine();
if(un_numero%10==4)
System.out.println("El n\u00FAmero s\u00ED termina en 4");
else
System.out.println("El n\u00FAmero no termina en 4");
}
}
public class NumeroTerminaEn4 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int un_numero;
System.out.print("Ingresa el valor de un numero: ");
un_numero = in.nextInt();
in.nextLine();
if(un_numero%10==4)
System.out.println("El n\u00FAmero s\u00ED termina en 4");
else
System.out.println("El n\u00FAmero no termina en 4");
}
}