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"); } }

18th Aug 2021, 3:53 AM
Masi Soltani
Masi Soltani - avatar
2 ответов
+ 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")
18th Aug 2021, 4:10 AM
Simba
Simba - avatar
+ 1
Masi Soltani And also you have closed bracket after taking input which should not be there.
18th Aug 2021, 6:50 AM
A͢J
A͢J - avatar