Since all the integers in your example are positive, I assume that you are not interested in the case when one or both operands are negative or zero.
Math.Round works with floating point numbers. There is no need.
Separating two integers gives an integer result. It is always rounded. You want something like this:
int Divide(int numerator, int denominator) { return (numerator + denominator - 1) / denominator; }
For example, for 1/4 we get (1 + 4 - 1) / 4 = 4 / 4 = 1 , and for 8/4 we get (8 + 4 - 1) / 4 = 11 / 4 = 2 .
There is very little possibility of overflow, therefore, if the numerator is always greater than zero, it is better to use:
int Divide(int numerator, int denominator) { return 1 + (numerator - 1) / denominator; }
source share