Here is the code for Mod function in C#. Have given two ways. The first one is the C % operator
private void ModFunctionCsharpExample()
{ int iRemainder = 31 % 3;
MessageBox.Show("Remainder is " + iRemainder.ToString()); int iQuotient = Math.DivRem(31, 3, out iRemainder);
MessageBox.Show("Remainder is " + iRemainder.ToString() + " and the Quotient is " + iQuotient);
}
No comments:
Post a Comment