import java.util.Random;
import java.util.Scanner;
public class desafio {
public static void main(String[] args) {
Scanner teclado = new Scanner(System.in);
int numeroSecreto = new Random().nextInt(100);
int numeroIngresado = 0;
int intento = 0;
for (int i = 0; i < 5; i++) {
System.out.println("Ingrese un número entre 1 y 100 :");
System.out.println("tiene sólo " + (5 - intento) + " intentos");
numeroIngresado = teclado.nextInt();
intento++;
if (numeroIngresado == numeroSecreto) {
System.out.println("Acertaste al numero Secreto que era el " + numeroSecreto + " en " + intento + " intentos");
break;
} else {
if (numeroSecreto > numeroIngresado) {
System.out.println("el número secreto es mayor que " + numeroIngresado);
} else {
System.out.println("el número secreto es menor que " + numeroIngresado);
}
}
}
if (intento == 5 && numeroSecreto == numeroIngresado) {
System.out.println("El juego ha terminado, eres el Ganador en el ultimo intento!!");
} else {
if (intento == 5) {
System.out.println("No le quedan mas intentos, Ha finalizado el juego, el numero secreto era el " + numeroSecreto);
}
}
}
}