cm to feet code example

Example 1: m to cm

1 meter = 100 centimeters

Example 2: cm to foot

1 cm = 0.032808399 foot

Example 3: cm to inches

1 cm = 0.393701 inch

Divide the cm value by 2.54.

Example 4: foot to cm

1 foot = 30.48 cm

Example 5: cm to foot

# 1 cm = 0.0328084 foot

# Divide the cm value by 30.48

def cm_to_foot(cm):
  return cm/30.48

print(cm_to_foot(1)) # Result- 0.0328084

Example 6: cm to inches

const cm = 1;

console.log(`cm:${cm} = in:${cmToIn(cm)}`);

function cmToIn(cm){
	var in = cm/2.54;
    return in;
}

Tags:

Misc Example