Plz correct code

hello @Lovishbansal
your logics looks correct.
generalise it and submit ,it will work.