Google Interview Question

coding question was asked..simple one using for loop