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.
Use
scanf("%lf", &y);
instead. Since scanf("%f", &y); works for floats only.
If you enable compiler warnings it would tell you that the format specifier "%f" expects a float * and not double * argument.
You should use
scanf("%lf", &y);
You are using the wrong format specifier in the scanf and doing this will result in UB(Undefined Behaviour).The correct format specifier for a double is %lf while that of a float is %f. So Just change your scanf to
scanf("%lf",&y);