lundi 24 mai 2021

How to set a while loop?

I'm trying to set my code for counting math games, all math operations are fine except for division. I don't know how to set the while loop correctly. There is a problem with division, such that I would like the division to be residual, so I came up with one method which is given below. It is all in WPF Application. I would like to count only single-digit numbers.

Random number = new Random();
int maxValue = 10;
int total = 0;
int firstNumber = number.Next(1, maxValue);
int secondNumber = number.Next(1, firstNumber);
while (firstNumber % secondNumber != 0);
  {
  secondNumber++;
  }
total = firstNumber / secondNumber;

Why does it still show me the values ​​that have a residual division?

Thank you for any advice




Aucun commentaire:

Enregistrer un commentaire