I am trying to get the last round of this game to generate random numbers from 1 to 25 and the second random numbers to generate from 2 to 9 and of which the first number must be divisible by the second numbers.
i am wondering if the codes that i have created will be able to do just as the question ask.

note that: I haven't finished coding as yet

here is the codes that I have created so far.

for(i = 9; i<=10; i++)
{
rand = 1 + randobj.nextInt(25);
rand2 = 2 + randobj.nextInt(8);
correctans = rand / rand2;
incorrectans = 25 + randobj.nextInt(59);
while(num1 %2 != 0) would this work
{
if(num1 % num2 !=0)this also, will it work or do i have it wrong
{
}
}
System.out.println(playername+"round 3"+ "level "+ i+ "question "+i+ "you are required to match the letter with the correct answer");
System.out.println(playername+" please divide "+ rand+ " / "+ rand2);
System.out.println("A:"+correctans);
System.out.println("B:"+ incorrectans);
choice = userinput.next().charAt(0);

generate random numbers from 1 to 25 and the second random numbers to generate from 2 to 9 and of which the first number must be divisible by the second numbers.

One approach is trial and error - easy to code but inefficient in execution (not a problem with these values, but does not scale well)

do
generate both random numbers
while (their modulo is not zero)

another way is to generate the second random number (2-9) and a random multiplyer (1- 25/firstnumber) . Mutliply those together to get the first number. This will always work first time.