Question: what is the difference between f and lf?
Answer: For scanf , %f reads into a float , and %lf reads into a double . ... The reason that one specifier can be used for two different types in printf is because of the default argument promotions; arguments of type float are promoted to double when used to call a function and not matching a parameter in a function prototype.