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
  • 15,661
  • 20
  • 90
  • 161

1 Answers1

11
int i = (int)Math.Ceiling(d1/d2);
lc.
  • 109,978
  • 20
  • 153
  • 183