开发者

How to display a number of type Float64 upto one decimal place only

开发者 https://www.devze.com 2023-03-05 09:12 出处:网络
I have a variable , Float64 min; I want to display it only upto 1 place of decimal. Right now, I get 6 places if I use 开发者_C百科%f. How do I get only upto 1 place?Use:

I have a variable , Float64 min; I want to display it only upto 1 place of decimal. Right now, I get 6 places if I use 开发者_C百科%f. How do I get only upto 1 place?


Use:

printf("%.1f", min);

See any reference such as this for details.

0

精彩评论

暂无评论...
验证码 换一张
取 消