Saturday, December 28, 2024
Google search engine
HomeLanguagesPython Program to Convert cm to Feet and Inches

Python Program to Convert cm to Feet and Inches

Python program to convert a given height in centimeters to feet and inches; In this tutorial, you will learn how to convert height in cm to feet and inches.

Python Program to Convert cm to Feet and Inches

Let’s use the following algorithm to write a python program to convert the cm(centimeter) to inches, feet:

  • Python program to convert height centimeters to inches.
  • Python program to convert height centimeters to feet.

Python program to convert height centimeters to inches

See the following steps and write a python program to accept the height in cm and convert it into inches:

  • Take the input from user by using python input() function.
  • Convert the height in centimeters into inches.
  • Print the length in inches.
#take input from user
cm=int(input("Enter the height in centimeters:"))

#convert centimeter to inche
inches=0.394*cm

#print result
print("The length in inches",round(inches,2))

Output

Enter the height in centimeters: 167
The length in inches 65.8

Python program to convert height centimeters to feet

See the following steps and write a python program to accept the height in cm and convert it into feet:

  • Take the input from user by using python input() function.
  • Convert the height in centimeters into feet.
  • Print the length in feet.
#take input from user
cm=int(input("Enter the height in centimeters:"))

#convert centimeter to feet
feet=0.0328*cm

#print result
print("The length in feet",round(feet,2))

Output

Enter the height in centimeters: 167
The length in feet 5.48

Recommended Python Programs

RELATED ARTICLES

Most Popular

Recent Comments