0
Difference between %f and %lf
#include <stdio.h> int main() { double a,b,c; scanf("%f %f",&a,&b); c=b/0.02; if(c<a){ printf("Dollars"); }else{ printf("Pesos"); } return 0; } /* when using “%lf” it works ,so what’s the difference between “%f” and “%lf” */
1 ответ
+ 2
For printf, arguments of type float are promoted to double so both %f and %lf are used for double. For scanf, you should use %f for float and %lf for double.