printf float value in c code example
Example 1: format specifier fro float in printf
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.
Example 2: printf c float
printf("%.6f", myFloat);