0
if the user enter wrong number the program doesn't ask him for another try so how could l fix it
9 Réponses
0
See if this works-
https://code.sololearn.com/ceORVsO1T6PT/?ref=app
0
You want the program to ask the user again or not? Also share the code so that we can understand your situation.
0
i shared the code link
you could take a look
and here is the code link again
http://www.sololearn.com/app/java/playground/cXMbS5SbTEmN/
0
The link leads to the sololearn app in play store.
0
how ?
it's must lead you to my code on the playground
0
Would you mind copy pasting the code here because I really cannot reach it.
0
import java.util.Scanner;
public class Javagame {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int guess ,rand;
rand =(int) (Math.random ()*10) ;
boolean stillplaying = true;
for(int i=1 ;i<=10;i++){
if(i==rand)
{
continue;
}
System.out.println(i);
}
System.out.println("try to fined the missed number between 1 and 100");
guess = input.nextInt();
if(guess>10|| guess<=0)
System.out.println("out of range");
else if (guess!=rand&& guess>0&& guess<=10 )
System.out.println("you are wrong dude");
else if(guess==rand)
{
System.out.println("You Win");
stillplaying = false;
}
}
}
0
oh i forget while(stillplaying)
thank you alot dude ❤️
0
Mahmoud Hamed you're welcome👍