Print Integer with 2 decimal places in Java

后端 未结 7 935
轻奢々
轻奢々 2020-12-16 15:10

in my code i use integers multiplied by 100 as decimals (0.1 is 10 etc). Can you help me to format output to show it as decimal?

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-16 15:51

    you can use double instate of int. it gives you a output with decimals. and then you can divide with 100.

提交回复
热议问题