solve this problem using array..

Printable View