how to find modulus of a number in c#
how to find modulus of a number in c# .net开发者_运维问答?
With the modulus operator %:
int x = 4545;
int mod = x % 16;
Via the '%' operator.
e.g. int i = 10 % 3;
(result: i is 1)
Use this site
http://www.willasrari.com/blog/use-c-modulus-operator-to-determine-even-or-odd-numbers/000166.aspx
Basically the % opearator: x%y
精彩评论