Showing posts with label division. Show all posts
Showing posts with label division. Show all posts

Friday, 23 December 2011

C# Modulo Operator - Find easy the remainder of a division.






Percentage symbol



You want to see examples of the modulo division operation in the C# language, which allows you to execute code once every several iterations of a loop. The modulo operator uses the percentage sign % character in the lexical syntax and has some unique properties. Here we look at the modulo division operation.
Estimated costs of instructions

Add:         1 ns
Subtract:    1 ns
Multiply:  2.7 ns
Divide:   35.9 ns

Example 1