0

How to fix this?

package exercises; import java.util.Scanner; public class Ex1 { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Input first number: 25"); int num1 = in.nextInt(); System.out.print("Input second number: 5"); int num2 = in.nextInt(); System.out.println(num1 + " x " + num2 + " = " + num1 * num2); in.close(); The output should be 25 x 5 = 125 but in console it only shows: Input first number:

22nd Nov 2016, 8:33 PM
Zoro R
Zoro R - avatar
3 Réponses
0
can you explain in a little more detail simonde?
22nd Nov 2016, 9:05 PM
Dubble S
Dubble S - avatar
0
I don't understand you
22nd Nov 2016, 9:05 PM
Zoro R
Zoro R - avatar
0
your code : import java.util.Scanner; public class Ex1 { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Input first number: 25 "); int num1 = in.nextInt(); System.out.print("Input second number: 5 " ); int num2 = in.nextInt(); System.out.println(num1 + " x " + num2 + " = " + num1 * num2); in.close(); } } with Eclipse give the correct output:
23rd Nov 2016, 6:40 AM
Simone Novaro
Simone Novaro - avatar