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
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 the source code of the Python Program to Calculate the Average of Numbers in a Given List. The program output is also shown below.
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.
Runtime Test Cases
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
Name | Views | Likes |
---|---|---|
Python Program to Read Height in Centimeters and then Convert the Height to Feet and Inches | 891 | 11 |
Comments