float ratio = kills / deaths;
system.out.printf("Kill Death Ratio: %0.2f", ratio);
try that
|
So we already know I have a division system which shows the follow..
Kills/Deaths - The thing is with this even if I do that division if I have 11 Kills and 5 Deaths it still says just 2.
My question is how to make it go to lets say 2 decimal places?
float ratio = kills / deaths;
system.out.printf("Kill Death Ratio: %0.2f", ratio);
try that
Sorry was reading up about it on Google, figured it out.
Using Double.
If anyone needs
double Ratio = (double) kills / (double) deaths;
use a double or a float
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |