SHARE
TWEET

Untitled

a guest May 19th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static class MathUtil
  2. {
  3.     public static IEnumerable<int> DivideEvenly(int numerator, int denominator)
  4.     {
  5.         var div = Math.DivRem(numerator, denominator, out int rem);
  6.  
  7.         for (int i = 0; i < denominator; i++)
  8.         {
  9.             yield return i < rem ? div + 1 : div;
  10.         }
  11.     }
  12. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top