+ 1

Don't know what is wrong with line 6 and 8 ...pls I need help...

public class myProgram { public static void main(String[] args) { Scanner answer= new Scanner (System.in) String Q=("iam thinking of a number in my mind btw 1 to 10,can u guess d number"); //answer is 5 System.out.println(Q) int answer=answer.nextInt(); if(ansNum<5) { System.out.println("higher"); } else if(ansNum>5) { System.out.println("Lower"); } else if(ansNum==5) { System.out.println("you are very correct"); } else { system.out.println("that number is not between 1 to 10....your mistake"); } } }

25th Aug 2018, 2:20 PM
Adeleke Bamidele
Adeleke Bamidele - avatar
3 Answers
+ 5
int ansNum=answer.nextInt();
25th Aug 2018, 8:44 PM
Mert Yazıcı
Mert Yazıcı - avatar
+ 2
You didn't put semicolon ";"
25th Aug 2018, 3:25 PM
Bashir Ahmad
Bashir Ahmad - avatar
0
1 more error to be solved in line 9
25th Aug 2018, 5:21 PM
Adeleke Bamidele
Adeleke Bamidele - avatar