Run normal on Eclipse but get RESULT 0 in SPOJ website and get some error
I'm new bie
I have a small java program. This is my code
import java.util.Scanner;
class Mark {
private static Scanner sc;
public static void main(String[] args) {
sc = new Scanner(System.in);
System.out.println("press mark: ");
float a = sc.nextFloat();
if ( a <= 100 && a >= 90 )
System.out.println("A");
if ( a >= 85 && a < 90 )
System.out.println("A-");
if ( a >= 80 && a < 85 )
System.out.println("B+");
if ( a >= 75 && a < 80 )
System.out.println("B");
if ( a >= 70 && a < 75 )
System.out.println("B-");
if ( a >= 65 && a < 70 )
System.out.println("C+");
if ( a >= 60 && a < 65 )
System.out.println("C");
if ( a >= 55 && a < 60 )
System.out.println("C-");
if ( a >= 53 && a < 55 )
System.out.println("D+");
if ( a >= 52 && a < 53 )
System.out.println("D");
if ( a >= 50 && a < 52 )
System.out.println("D-");
if ( a >= 0 && a < 50 )
System.out.println("F");
}
}
It's normal when I run on Elipse but get RESULT 0 in SPOJ website and get some error
Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Scanner.java:862) at java.util.Scanner.next(Scanner.java:1485) at java.util.Scanner.nextFloat(Scanner.java:2345) at Mark.main(Main.java:10)
Pls help me. Thanks you
链接地址: http://www.djcxy.com/p/17224.html