nested for loop code