I'm super new to Java and wanted to do a little code, but somehow i got stuck on the while loop! it seems like my compiler is just not reading into the loop, and i know it has something to do with my variables but i genuinely do not know what to do :/ thank you for your help! and yes, i already looked through similar problems but none of them seemed to help me. also sorry if the output is in german, i am from luxembourg :)
System.out.println("Ist die gesuchte Zahl größer als die angegebene Zahl?");
while (ja) {
System.out.print("Wir haben die Zahl gefunden!");
}
while (nein) {
System.out.print("Ist die gesuchte Zahl größer oder kleiner?");
if (kleiner) {
int nummer2 = 1 + (int)(100*Math.random()) - nummer;
System.out.println("Ist " + nummer2 + "die gesuchte Zahl?");
}
else if (größer) {
int nummer3 = 1 + (int)(100*Math.random()) + nummer;
System.out.println("Ist " + nummer3 + "die gesuchte Zahl?");
}
}
Aucun commentaire:
Enregistrer un commentaire