+ 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
4 Answers
+ 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
0
it tells me" java.util.nosuchelementexception"
and "looks like your program needs input
split multiple inputs in separate lines"
0
I think use import java.util.* and check by using system.out.print
0
A, B, C are Double but you asking the Console for nextInt two times (B & C)