Answers for "printf c float"

4

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.
Posted by: Guest on October-11-2020
0

print float in c

printf("%.6f", myFloat);
Posted by: Guest on November-24-2020

Browse Popular Code Answers by Language