C# Modulus

The modulus operator % returns the remainder of a division.

using System.Windows.Forms;
int sum=24;
int m = sum % 11;
MessageBox.Show(m.ToString()); //3

To get the quotient:
using System.Windows.Forms;
int sum=24;
int q = sum - sum % 11;
MessageBox.Show(q.ToString()); //2




endmemo.com © 2024  | Terms of Use | Privacy | Home