Calculation problems in If Satements

So for a school project we need to make a program that calculates the hypotenuse of a triangle, and outputs the length in the appropriate metric unit of length. So i set up the program so that if the user enters 5cm, it will multiply the 5 by 10 so that it is in MM for later when i need to find the unit of length for the hypotenuse. during trial runs, i had the program output the lengths to make sure that it calculated them properly and it did. But then for the hypotenuse, i had the following if statement:

if (z >= 10)
hType = "cm";
} else if (z >= 1000)
hType = "m";
} else if (z >= 1000000)
hType = "km";

z is the length of the hypotenuse and hType is the unit of measurement of the hypotenuse. Since it is calculated in MM, I'm trying to set it up for the final output of the length. Every time i run the program though, it outputs hType as cm. Please help if you can. Thanks
Arrange the tests in reverse order, km first, then m, finally cm.
Topic archived. No new replies allowed.