📜  printf中的float格式说明符-C编程语言代码示例

📅  最后修改于: 2022-03-11 15:04:43.029000             🧑  作者: Mango

代码示例1
printf("%0k.yf" float_variable_name)

Here k is the total number of characters you want to get printed. k = x + 1 + y (+ 1 for the dot) and float_variable_name is the float variable that you want to get printed.

Suppose you want to print x digits before the decimal point and y digits after it. Now, if the number of digits before float_variable_name is less than x, then it will automatically prepend that many zeroes before it.