i have solved this question using array, but unable to do so without using array, please help me in it!!