would this work? (i tested in java--never used c#--and it works fine, but there might be some nuances.
// if altitude is more than 5000, decrement it by 5000
// if it is less than 5000, decrement it by its own value
// hence setting it to zero
altitude -= (altitude >= 5000) ? 5000 : altitude;
slightly more terse...oh well.
also, i realize this thread is over a year old, but alas...bless google for bringing me to it.