Can you please tell me where i m going wrong

instead of float use int
because in question it is not mention to print answer with decimal

also print endl after each testcase
so that output of every testcase comes in a newline

Modified Code