Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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??
  • Leaders
Posted

Use the modulus operator.

Dim I As Int32
I = 10010
MessageBox.Show((I Mod 100).ToString())
' Displays "10"

int i;
i = 10010;
MessageBox.Show((I % 100).ToString());
// Displays "10"

[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...