Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can someone explain the 'mod' operator in VB.net in the simplest way possible?

I have this code I need to explain and the Mod operator has confused me, MSDN has a page on it and I cannot understand it clearly. I have included a section of code below if you could refer to it in your answer, thanks.

number1 = (input1/ 10) - 0.5
number2 = input2 Mod 10

Result = number1 + number2
like image 608
JoeS Avatar asked Sep 28 '16 18:09

JoeS


1 Answers

Mod in VB.NET is the Modulo operation. It returns the remainder when one number is divided by another.

For example, if you divided 4 by 2, your mod result would be 0 (no remainder). If you divided 5 by 2, your mod result would be 1.

Explanation of the Modulo operation

like image 141
Michael Armes Avatar answered Sep 25 '22 19:09

Michael Armes