Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Next larger integer after dividing [duplicate]

Tags:

c#

Possible Duplicate:
How to Round Up The Result Of Integer Division

double d1=11, double d2=2
int i=d1/d2;

i would be 5. But I would like it to return 6. (if the result is 5.01, I would want a 6 too) How should I do it?

like image 705
william007 Avatar asked Sep 21 '12 06:09

william007


1 Answers

int i = (int)Math.Ceiling(d1/d2);
like image 96
lc. Avatar answered Oct 03 '22 18:10

lc.