Solution, using no functions:
Inches:
Centimeters: