Integer a = totalRecords.size(); //1250 decimal b = 400; integer block = a/b; //3
The actual result of 1250/400 is 3.125. Because I used integer block, I get 3 as answer. Instead of that if I use
decimal block = a/b; I get the result as 3.125
But what I want is, if the result is not perfect number (anything with decimals, like 3.125), I want it to be shown as 4 (increment by 1). If its perfect division, then I want to leave it as it it.
How to achieve this? Please let me know.
1303/5 = 260.6, I want the result to be 261 1300/5 = 260. I want 260 only.