[change] changed for loop with foreach loop in printTriangle