This is a Python Program to read height in centimeters and then convert the height to feet and inches
The program reads the height in centimeters and then converts the height to feet and inches.
1. Take the height in centimeters and store it in a variable.
2. Convert the height in centimeters into inches and feet.
3. Print the length in inches and feet.
4. Exit.
Here is source code of the Python Program to Calculate the Average of Numbers in a Given List. The program output is also shown below.
cm=int(input("Enter the height in centimeters:")) inches=0.394*cm feet=0.0328*cm print("The length in inches",round(inches,2)) print("The length in feet",round(feet,2))
1. User must enter the height in centimeters.
2. The height in centimeters is multiplied by 0.394 and stored in another variable which now contains the height in inches.
3. The height in centimeters is multiplied by 0.0328 and stored in another variable which now contains the height in feet.
4. The converted height in inches and feet is printed.
Case 1: Enter the height in centimeters:50 The length in inches 19.7 The length in feet 1.64 Case 2: Enter the height in centimeters:153 The length in inches 60.28 The length in feet 5.02
No comments:
Post a Comment