Why is this code giving wrong answer?

I have submitted by code and it runs correct for custom input

@dhruvtrehan45 Hello dhruv please share code using coding blocks ide

hey dhruv why are u using while loop while ((rows > 1 && rows < 10 ) && (cols > 1 && cols <10))?