i wanted to write if user try more than 5 times , then it will use system.out.println("You have tried more than 5 times") but i am unsure how to write my codes.
this are my codes for now . do i need to use if else statement or ? anw , thanks in advance
int userTry = 0;
double value1 = 0;
Scanner useranswer1 =new Scanner(System.in);
if(userTry == 5){
do{
System.out.println("What is 10 divided by 4?");
value1 = useranswer1.nextDouble();
}
while(value1 != 2.5);
System.out.println("You got the right answer");
} else {
} System.out.println("You have zero more tries");
}
Aucun commentaire:
Enregistrer un commentaire