plz check whats wrong
Pattern inverted hour glass
your code will run only for n=5 in any other case it will not work
i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved
if you have more doubts regarding this feel free to ask