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-31-2011, 12:34 AMHypeUsing 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-31-2011, 12:43 AMVaseCode:
`int result = (int)Math.round(7.0 / 9.0);`

- 01-31-2011, 12:43 AMtanjo3Code:
`double a, b, ans;`

ans = Math.ceil(a / b);

- 01-31-2011, 12:57 AMHype
Thanks guys