Why i am not getting correct output

I have edited your code… Try to submit now…