using namespace std;
Check your input for-
If it prints -0.5 , i think you get the whats wrong in logic.
the output for 120 120.0 is 120, as demanded in the problem, um thats not problem
Try this test case then, if 120 120 isnt the failing case then this must be.
Input 119.9 120
Correct output is 120.00
@vijju according to the problem the first number is an integer and second one is a real number. So a better test case would be this :-
Input: 120 120.25
Correct Output: 120.25
Yes you are right. The point was just that, when the values are very close. 120 and 120.1 should also do. Thanks for pointing that out, i will keep it in mind next time