I am trying to create a program in Java in which the computer randomly guesses a number between 1-100 and allows the user to guess to the number.
If the number is lower
Well I crossed across this topic and would like to share the code I figured out too since it was a fun question.This can even be used as a simple game.below is the psuedocode for it :D
do{
number=(int)(Math.random()*100);
}while(number<10);
do
{
lottery=Integer.parseInt(JOptionPane.showInputDialog(null,"guess the two digit number which is in my mind!!!! \nenter the number"));
if(numberlottery)
{
JOptionPane.showMessageDialog(null,"guess a more higher number");
count ++;
}
else
JOptionPane.showMessageDialog(null,"you have guessed the correct number "+number+" in"+count+" tries");
}while(lottery!=number);