I am currently working on a program/conversion calculator that when you input the altitude, it will give you the temperature. This is my first time coding and I'm unsure as to why this one isn't working, please do give me tips or any way I can make this work as I can't find anything online that tells me their specific code.

You appear to be using metric units in your calculations

I think this correct (didn't make a Block example)

To convert temperature for altitude in meters, use the standard temperature change rate of -6.5°C per 1000 meters of altitude higher than your present altitude. Every 1000 meters you go up in altitude, the temperature decreases by 6.5°C. This is an approximation

Examples:

- If the temperature at sea level is 20°C and you want to know the temperature at an altitude of 2000 meters:
- New Temperature = 20°C - (2000 / 1000) * 6.5°C = 20°C - 13°C = 7°C

- If the temperature is 20°C at your altitude of 100 meters above sea level and you want to know the temperature at an altitude of 2000 meters:
- New Temperature = 20°C - ((2000 - 100) / 1000) * 6.5°C = 20°C - 12.35°C = 7.65 °C

1 Like