+ 1

why my compiler not take input?

import java.util.*; // Compiler version JDK 11.0.2 class Dcoder { public static void main(String args[]) { System.out.println("enter your marks!"); Scanner s=new Scanner(System.in); int marks=s.nextInt(); if(marks>=65&& marks<=100) { System.out.println("exelent"); }else if(marks>=45&& marks<=65) {System.out.println("second devision");} else{ System.out.println ("fail"); }}}

31st Jul 2022, 6:31 AM
Sachin Patel
Sachin Patel - avatar
1 Answer
+ 3
It asks for input in Playground, not sure what's wrong with your machine. Apart from the input issue, there is a possible typo in the conditions. Range of "second devision" is from 45 ~ 65 but range of "excellent" is from 60 ~ 100.
31st Jul 2022, 7:15 AM
Ipang