CJCoding With Joseph
15free / daySign inCreate account

Use DecimalFormat with the pattern '0.##' to format a decimal, removing unnecessary trailing zeros.

In DecimalFormat patterns, '#' shows a digit only when non-zero, so trailing zeros are dropped. '0.##' allows up to 2 decimal places but hides trailing zeros (12.500 becomes '12.5').

⚠️ AUTO-INPUT MODE: The input stream will automatically contain '12.500\n'. Use Scanner's nextDouble() to read it.

Expected output

Value: 12.5

= newline. The output ends with a newline, so print one after the last line.

Hints4 available
Topics
Miscellaneous
Auto-input
12.500\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (sysout, psvm, fori)

Your output

Run your code to see the output here...

Test cases

Run your code to see test case results.