0

Trying to use a Scanner to capture the user´s answer and based on it, activate a if/else command. The code will capture the user answer but wont activate the if/else.

   System.out.println("Deseas que restemos algun numero?");
   valoruno = in.nextLine();
   if(valor="yes"){
  
    System.out.println("Ingresa el numero a restar: ");
    num_tres = in.nextInt(); 
 
   resultado_dos = resultado - num_tres;
   System.out.println("El resultado de tu resta es: " + resultado_dos);

    }else if(valor= "No"){
    System.out.println("Ten un excelente dia");`
InSync
  • 4,851
  • 4
  • 8
  • 30
yego_456
  • 1
  • 3

0 Answers0