Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
printf() 関数を使用して浮動小数点数を出力し、0 でない場合に小数部分のみを出力するにはどうすればよいですか? 例:
1.0 -> 1 2.0 -> 2 1.5 -> 1.5 2.25 -> 2.25
等
printf("%g\n",5.0); printf("%g\n",5.1);