Ask user think of a no. then you need to guess that no.then find whether that guess is too far or near and count the attempts | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Ask user think of a no. then you need to guess that no.then find whether that guess is too far or near and count the attempts

https://code.sololearn.com/cXeU1uJVnXnp/?ref=app

11th Sep 2018, 5:03 PM
Shivyaaa
4 Answers
0
Something like this https://code.sololearn.com/cNPCUY1om9YM/#java Just ask if you got any question about the code
11th Sep 2018, 11:26 PM
JavaBobbo
JavaBobbo - avatar
0
if we do not want to use math. random neither scanner class in Java then what do we write
12th Sep 2018, 2:46 AM
Shivyaaa
0
You can use the Random class: Random rand = new Random(); and then rand.nextInt(10); Try it out yourself, then you learn best
12th Sep 2018, 9:15 AM
JavaBobbo
JavaBobbo - avatar
0
I made the code for you.. The Scanner its a must because the user will enter a number. The Random class will only give you the random number. https://code.sololearn.com/cNPCUY1om9YM/#java
12th Sep 2018, 7:17 PM
JavaBobbo
JavaBobbo - avatar