# Golang Program to Convert Centimeters into Feet and Inches

Go ProgrammingServer Side ProgrammingProgramming

## Steps

• Take the height in centimeters and store it in a variable.
• Convert the height in centimeters into inches and feet.
• Print the length in inches and feet.
 Enter the height in centimeters: 50The length in inches: 19.7The length in feet: 1.64 Enter the height in centimeters: 153The length in inches: 60.28The length in feet: 5.02

## Explanation

• User must enter the height in centimeters.
• The height in centimeters is multiplied by 0.394 and stored in another variable which now contains the height in inches.
• The height in centimeters is multiplied by 0.0328 and stored in another variable which now contains the height in feet.
• The converted height in inches and feet is printed.

## Example

Live Demo

package main
import "fmt"
func main(){
var n int
fmt.Print("Enter the height in centimeters: ")
fmt.Scanf("%d", &n)
inches:=0.394*float32(n)
feet:=0.0328*float32(n)
fmt.Println("The length in inches:", inches)
fmt.Println("The length in feet:", feet)
}

## Output

Enter the height in centimeters: 50
The length in inches: 19.699999
The length in feet: 1.64