If you know how to use arrays, then this problem becomes very, very simple.