+ 1

this code works on eclipse but not here, why?

" import java.util.Scanner; class Calc{ public static void main(String[] args) { double A, B, C; Scanner dis =new Scanner(System.in) ; System.out.println("Enter first number: ") ; A= dis.nextDouble() ; System.out.println("Enter second number: ") ; B= dis.nextInt() ; System.out.println("Enter third number: ") ; C= dis.nextInt() ; if(A>B || A>C){ if(B>C) { System.out.println(A*A+B*B); } else if(C>B){ System.out.println(A*A+C*C); } else if(C==B){ System.out.println(A*A+B*B); } } else{ System.out.println(B*B+C*C); } } }" pls help

20th Jul 2016, 10:32 AM
Yahia Ragae
Yahia Ragae - avatar
4 Respostas
+ 1
I have tried here in Code Playground. It works for me. In order to enter A B C value, you need space. For example: 2.2 3 5
20th Jul 2016, 1:10 PM
WPimpong
WPimpong - avatar
0
it tells me" java.util.nosuchelementexception" and "looks like your program needs input split multiple inputs in separate lines"
20th Jul 2016, 1:19 PM
Yahia Ragae
Yahia Ragae - avatar
0
I think use import java.util.* and check by using system.out.print
20th Jul 2016, 2:43 PM
jm teja
jm teja - avatar
0
A, B, C are Double but you asking the Console for nextInt two times (B & C)
20th Jul 2016, 5:38 PM
Yargi
Yargi - avatar