0
Why not working printf on Java in the app?
Example: System.out.printf("Float number is " + "%.2f");
7 Antworten
+ 1
Not sure why printf wouldn't be working.
However, I know String.format will work on code playground.
Example/
System.out.println(String.format("%.2f", nbr*pi));
Little more to write though 😖
Edit:
Actually, doing the same thing with printf worked fine for me:
https://code.sololearn.com/ch84ZHUS7C7F/?ref=app
0
have you tried System.out.println(); or just System.out.print();
0
Yes, I have tried it and then it will print out like text not make number shorter.
0
im assuming theres more code becuase here your just printing your text using " " usually there should be variables
0
https://code.sololearn.com/cM9lxn7En339/?ref=app
Here I am trying
I want the printed number will be with 2 decimals.
If you try at eclipse, it is working well.
0
sorry i think i may be out my depth here as i havent covered pi,math or irational numbers with java. i know that irrational numbers can go on forever without repeating so im unsure if that could be the problem.... :/ i hope somone can help you
0
Yes, I have noticed it in printf. it was using comma.
Thanks for helping.