The temperature in a town was 24 degrees at midday. The temperature rose by 5 degrees to reach a maximum at 2pm and the dropped 17 degrees before midnight. what was the temperature at midnight?

24 + 5 - 17

To find the temperature at midnight, we need to take into account the temperature changes throughout the day.

Given:
- The temperature at midday was 24 degrees.
- The temperature rose by 5 degrees to reach a maximum at 2pm.
- The temperature then dropped by 17 degrees before midnight.

To calculate the temperature at midnight, we need to calculate the cumulative changes in temperature throughout the day.

Step 1: Temperature rise from midday to 2pm
The temperature rose by 5 degrees. So, adding 5 degrees to the initial temperature of 24 degrees gives us 24 + 5 = 29 degrees.

Step 2: Temperature drop from 2pm to midnight
The temperature dropped by 17 degrees from the maximum temperature at 2pm (which was 29 degrees). So, subtracting 17 degrees from 29 degrees gives us 29 - 17 = 12 degrees.

Therefore, the temperature at midnight was 12 degrees.