Now, we can proceed to the next step:
๐ป C#
// Add the two numbers.
// --> Check if the sum is odd or even.
// Decide the round winner.A common way to do it is by using the modulo operator.
๐ Learn
We need to calculate the modulo of the sum by 2 and
compare
it with 0.
The result of any comparison is no longer a number, but instead a
boolean
value. A comparison result is either true or
false.
If the modulo is 0, it returns true meaning
the number is even, otherwise it returns false meaning its
odd.
โ What to Do
โ๏ธ Program.cs - Changes
// Check if the sum is odd or even.
++ bool sumIsEvens = sum % 2 == 0;๐๏ธ Program.cs - Final
(...)
// Check if the sum is odd or even.
bool sumIsEvens = sum % 2 == 0;
(...)