first take input min and then max if this solves your doubt please mark it as resolved and rate as well