how i am getting the right output but the the condition is not satisfied?