Hi,

I'm dividing two double numbers 7.0 and 9.0 (which is 0.777777778) and I need to round off that answer using Math.round so the answer is 1. How would I code that?

Printable View

- 01-30-2011, 11:34 PMHypeUsing math.round
Hi,

I'm dividing two double numbers 7.0 and 9.0 (which is 0.777777778) and I need to round off that answer using Math.round so the answer is 1. How would I code that? - 01-30-2011, 11:43 PMVaseCode:
`int result = (int)Math.round(7.0 / 9.0);`

- 01-30-2011, 11:43 PMtanjo3Code:
`double a, b, ans;`

ans = Math.ceil(a / b);

- 01-30-2011, 11:57 PMHype
Thanks guys