0
我正在製作一個程序,它會詢問您是否要執行加法,減法,乘法和除法。然後它會詢問有多少問題。我有一切工作,但司。我想確保在分區問題時不會有剩餘部分。我不知道如何做這項工作。數學:劃分問題發生器
else if (player==4) {
System.out.print("How many questions would you like?-->"); player =
in.nextInt(); numQuestions= player;
do{
//question
do {
do{
num1 = (int) (Math.random() * 100);
num2 = (int) (Math.random() *10);
}while (num2 > num1);
} while (num1 % num2 == 0);
compAnswer = num1/num2;
System.out.println(num1+"/" + num2 + "=");
System.out.print("What's your answer? -->");
player = in.nextInt();
if (player == compAnswer) {
System.out.println(" That's right, the answer is "
+ compAnswer);
System.out.println("");
score++;
} else {
System.out.println("That's wrong! The answer was "
+ compAnswer);
System.out.println("");
}
//x++;
}while(x < numQuestions + 1);
System.out.println("");
System.out.println("Thanks for playing! Your score was " + score +
"."); }