If a page can have 27 items printed on it and number of items can be any positive number then how can I find number of pages if I have number of items, I tried Modulus and division but didn't helped.
FYI, I am using C# as programming platform.
If a page can have 27 items printed on it and number of items can be any positive number then how can I find number of pages if I have number of items, I tried Modulus and division but didn't helped.
FYI, I am using C# as programming platform.
If I understand the question correctly, isn't the answer just the number of total items divided by $27$ and then rounded up?
If you had $54$ total items, $54/27=2$ pages, which doesn't need to round.
If you had $100$ total items, $100/27=3.7$ which rounds up to $4$ pages.
If you had 115 total items, $115/27=4.26$ which rounds up to $5$ pages.
I'm not sure if I understood you correct. Assume you have int "items" that express the quantity of items to be printed.
wholePages expresses how much whole pages will be printed, totalPages tells on how many pages you will print something. "totalPages" is calculated in easy way; it can be made shorter
int wholePages = items / 27; int totalPages = items / 27 + ( items % 27 > 0 ? 1 : 0 );