Java While Loop Number Guessing Program
Please Find my error if my answer is right,there is no error.If my answer is wrong, it says Exception in thread "main" java etc... I don't understand what it says please help me 😭 import java.util.Scanner; public class Program { // Can u guess a number public static void main(String[] args) { int a = 0, answer = 7; Scanner sc = new Scanner(System.in); while (a != answer){ a=sc.nextInt(); System.out.println("Enter Number"+ a); if (a==answer) System.out.println("You are Right"); else{ System.out.println("You are Wrong"); if(a<answer) System.out.println("Too Low"); else System.out.println("Too High"); } } } }