I'm making a Flashcard program for 5th graders to practice their math skills. Whenever they get to the division part of the program, it does not generate evenly divisible numbers. I've generated two numbers like so:
int divisor_one = 1+rand()%5 * 2;
int divisor_two = 1+rand()%5 * 2;
I thought by multiplying it by two, it gives only even numbers but I was wrong. It generates a 5, as seen below.
********************************
Division Flashcards
********************************
3
5
_____
Clearly, these two numbers are not evenly divisible. How can I generate random evenly divisible numbers?
Aucun commentaire:
Enregistrer un commentaire