Hello everyone
|
Originally Posted by sandeeprao.techno
|
You can also use
|
Code:
|
System.out.println((a + b + c + d + e) / 5.0); |
|
When I use literals of type double I like to do this:
|
Code:
|
System.out.println((double)(a + b + c + d + e) / 5d); |
This shows me that the brackets result in a double and the 5 is a double. So no conversions is needed before devision.
Hope this helped.