function for calculation of altitude using only ints