Remainder??

rOSSybOY

Newcomer
Joined
Dec 2, 2005
Messages
6
say i have a 5 digit number like 10001, and i divide it by 100, the result would be 100.01, a decimal, how would i divide it to get a remainder instead of a decimal??
 
Use the modulus operator.
Visual Basic:
Dim I As Int32
I = 10010
MessageBox.Show((I Mod 100).ToString())
' Displays "10"
C#:
int i;
i = 10010;
MessageBox.Show((I % 100).ToString());
// Displays "10"
 
Back
Top