added A7 - for loop implementation