it was specified in Q? 2 use while loop thts why i hav solved using while loop.
i'll be thankful 2 u if i get some practice pattern.
Have a nice day