Creating random division problems with whole number answers

In class we have to generate random division problems the always answer in whole numbers.
So far I have:
$number1 = rand(0, 100);
$number2 = rand(1, 9);
$hiddentheCorrectAnswer= $number1 % $number2;
echo “what is “.$number1.” / “.$number2.” = ?”;

Now I just need to figure out how to get whole numbers as my answer. Any help will help me out thanks

http://php.net/manual/en/function.round.php

The answer has to be a whole number or you just can’t give the answer with a remainder?

^ If that is the case use

    [php] $number1 = rand(0, 100); 
     $number2 = rand(1, 9); 
     $hiddentheCorrectAnswer= $number1 / $number2; // You don't need this part
     echo "what is ".$number1." / ".$number2." = ?</br>";
     echo "It equals ".floor($number1 / $number2)."";[/php]

here’s the example the teacher gave us

http://207.62.77.141/dreamweaver/dreamstudent041/mathFacts7.php

the two random numbers are always numbers that can easily be divide into each other

thanks for help

Sponsor our Newsletter | Privacy Policy | Terms of Service