0
Java error
Why do I get error? What's wrong with it??? import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); double score = scanner.nextDouble(); } // your code goes here double grade= 2.9; if (grade>=3.5){ System.out.println("congratulations"); }else{ system.out.println("sorry"); } }
2 Answers
+ 8
You need to use score variable instead of grade to check the all inputs.
//double grade = 2.9;
if (score>=3.5)
First letter of the output variables should be uppercase.
System.out.println("Congratulations")
System.out.println("Sorry")
+ 1
Masi Soltani
And also you have closed bracket after taking input which should not be there.