Assignment 1 without iterator