Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class MathUtil
- {
- public static IEnumerable<int> DivideEvenly(int numerator, int denominator)
- {
- var div = Math.DivRem(numerator, denominator, out int rem);
- for (int i = 0; i < denominator; i++)
- {
- yield return i < rem ? div + 1 : div;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement