I remember in java that the modulo operator can be inverted, so instead of seeing what remains of the operation, you can invert it, so instead it will tell you many times when the number is divided by:
Console.WriteLine(1000 % 90); Console.WriteLine(100 % 90); Console.WriteLine(81 % 80); Console.WriteLine(1 % 1);
Conclusion:
Examples are courtesy of DotNetPerls.
Instead of seeing the remainder, I want to see how many times β80β entered β81β. Which should be 1 with a remainder of 1.
Does the C # modulo operator support this behavior? If not, how can you achieve the desired behavior? With a minimum code, please ...: D
EDIT:
I assume that the answer will be something simple, like separating two numbers and getting rid of the value β-. #β And saving the integer β1.-". I know about this, but should there be an easier way to do this?
source share