# what does % means C#

• ### Question

• Hi,

What does % means in C#?

```if (loopgo != loopmax)
pic.SetPixel(x, y, Color.FromArgb(loopgo % 128 * 2, loopgo % 32 * 7, loopgo % 16 * 14));

loopgo = 0 and loopmax = 1000.```
thanks!

Sunday, October 6, 2013 4:19 PM

• Hi ganeshgebhard,

% is also know as module operator in the c#, It return the reminder of division, for example 5  module(%) 2 return 1 and 4%(module) 2 return 0.

Regards Harsh

• Marked as answer by Sunday, October 6, 2013 5:04 PM
Sunday, October 6, 2013 4:28 PM
• Hi there,

Do you know divison in mathematics?

when we divide 5 by 2, we get quotient as 2 and reminder as 1.

module operator(%) gives you the reminder path, here in this case it is 1.

Regards Harsh

• Marked as answer by Sunday, October 6, 2013 5:04 PM
Sunday, October 6, 2013 5:02 PM

### All replies

• Hi ganeshgebhard,

% is also know as module operator in the c#, It return the reminder of division, for example 5  module(%) 2 return 1 and 4%(module) 2 return 0.

Regards Harsh

• Marked as answer by Sunday, October 6, 2013 5:04 PM
Sunday, October 6, 2013 4:28 PM
• I still don't get it..
Sunday, October 6, 2013 4:50 PM
• Hi there,

Do you know divison in mathematics?

when we divide 5 by 2, we get quotient as 2 and reminder as 1.

module operator(%) gives you the reminder path, here in this case it is 1.

Regards Harsh

• Marked as answer by Sunday, October 6, 2013 5:04 PM
Sunday, October 6, 2013 5:02 PM
• I get it! Thank you!

Sunday, October 6, 2013 5:04 PM
• I have one more quention..

`pic.SetPixel(x, y, Color.FromArgb(loopgo % 128 * 2, loopgo % 32 * 7, loopgo % 16 * 14));`

loopgo = 0. We can't divide 0 by 128 * 2, but I the program doesn't give any error...can you explain this?

thanks.

Sunday, October 6, 2013 5:20 PM