I am having problem with floating point numbers. I think something is clashing here.
The output is :
Using wrong format specifier invoke undefined behavior and that's why you are getting unexpected result. Once UB is invoked, you may either get expected or unexpected result. Nothing can be said. Use %lf to read double type data.
%lf
double