i want to get 2 numbers from user and do operation for him like 2*6 and when he wrote it he see 2*6=12 how i could code this ? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

i want to get 2 numbers from user and do operation for him like 2*6 and when he wrote it he see 2*6=12 how i could code this ?

system.out.println(num1*num2)

14th Feb 2020, 1:00 PM
Mahmoud Hamed
Mahmoud Hamed - avatar
4 Antworten
+ 3
Lesson about getting user input with scanner. https://www.sololearn.com/learn/Java/2220/ If it is a number, replace nextLine with nextInt
14th Feb 2020, 1:04 PM
Gordon
Gordon - avatar
14th Feb 2020, 1:32 PM
Mahmoud Hamed
Mahmoud Hamed - avatar
0
what i have to do to make the output as i said
14th Feb 2020, 1:32 PM
Mahmoud Hamed
Mahmoud Hamed - avatar
0
It is not hard. You have the last line correct. You need only three more lines above. Try it.
14th Feb 2020, 1:38 PM
Gordon
Gordon - avatar