import java.util.Random;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int tentativas = 0;
        int tentativasRestantes = 5;
        int numeroSecreto = new Random().nextInt(100);
        System.out.println("Tente adivinhar o número secreto entre 1 e 100, em 5 tentativas!");
        int verificarChute = 0;
        while (verificarChute != numeroSecreto) {
            System.out.println("Digite seu chute! ");
            verificarChute = scanner.nextInt();
            tentativas++;
            tentativasRestantes--;
            if (verificarChute == numeroSecreto) {
                System.out.println("Você descobriu o número secreto com " + tentativas + " tentativas!");
                break;
            } else if (verificarChute > numeroSecreto) {
                System.out.println("O número secreto é menor! Tente novamente! Restam " + tentativasRestantes + " tentativas!");
            } else {
                System.out.println("O número secreto é maior! Tente novamente! Restam " + tentativasRestantes + " tentativas!");
            }
            if (tentativasRestantes < 1) {
                System.out.println("Você esgotou o número de tentativas. Reinicie o jogo!");
                break;
            }
        }
    }
}
 
             
   
             Conte com o apoio da comunidade Alura na sua jornada. Abraços e bons estudos!
   Conte com o apoio da comunidade Alura na sua jornada. Abraços e bons estudos!