The logic is to sum the numbers in each row and divide by 2. For the first row: (5 + 4 + 7) / 2 = 16 / 2 = 8. For the second row: (6 + 9 + 5) / 2 = 20 / 2 = 10. For the third row: (3 + 7 + 2) / 2 = 12 / 2 = 6.