There is another common operator called the modulus operator - %. This is not a percentage, but the remainder when two numbers are divided. For example:
Console.WriteLine(10%2)//result = 0 (10/2 = 5 w/ remainder of 0)Console.WriteLine(10%9)//result = 1 (10/9 = 1 w/ remainder of 1)Console.WriteLine(16%3)//result = 1 (16/3 = 5 w/ remainder of 1)Console.WriteLine(19%5)//result = 4 (19/5 = 3 w/ remainder of 4)
% can be used to easily determine if a number is even or odd, even numbers % 2 are always 0.
To learn the modulus, the best thing to do is problems in your head. What is the result of the following:
In your Program.cs check on the answers above, and then practice using the different operators by logging a few things to the console, especially the modulus operator.