Median of two sorted array

why I am not getting my answer in decimal

at line no 41
float ans=(m1+m2)/2;

ans bucket is float but on right side
m1+m2 is integer and 2 is also integer so answer after division is also integer

what you should have to do is make any one float

like this

float ans=(m1+m2)/2.0;

i hope you got the point
if yes show your response with :heart: and don’t forgot to mark doubt as resolved
if you want to ask something about this feel free to ask

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.