5

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?

Community
  • 1
  • 1
william007
  • 17,375
  • 25
  • 118
  • 194

1 Answers1

11
int i = (int)Math.Ceiling(d1/d2);
lc.
  • 113,939
  • 20
  • 158
  • 187