logo

Programma om cm naar voet en inch te converteren

Hier zullen we leren hoe we de lengte, die wordt aangegeven in centimeters, kunnen omzetten naar de lengte in voet en inch.

Hieronder volgen de twee formules die helpen bij het omrekenen van cm naar voet en inch:

collecties in Java
  1. 1 inch = 2,54 centimeter
  2. 1 voet = 30,48 centimeter

Uit deze formules vinden we de volgende twee formules:

  1. inch = 0,3937 * Centimeter (cm)
  2. voet = 0,0328 * Centimeter (cm)

Programma 1: Schrijf een programma in C voor het omzetten van cm naar voet en inch.

 #include int main() { int centimeter = 40; double inch, feet; inch = 0.3937 * centimeter; feet = 0.0328 * centimeter; printf ('Inches is: %.2f 
', inch); printf ('Feet is: %.2f', feet); return 0; } 

Uitgang:

 Inches is: 15.75 Feet is: 1.31 

Programma 2: Schrijf een programma in PHP voor het converteren van cm naar voet en inch.

java synchroniseren
 <?php // This is a PHP program which converts the centimeter length to feet and Inches $cen = 10; $inch = 0.3937 * $cen; $feet = 0.0328 * $cen; echo('Inches is: ' . $inch . '
'); echo('Feet is: ' . $feet); ?> 

Uitgang:

 Inches is: 3.94 Feet is: 0.33 

Programma 3: Schrijf een programma in Java voor het converteren van cm naar voet en inch.

 // This is a Java program which converts centimeter length to feet and Inches import java.io.*; class convert { static double Conversion_length(int centimeter) { double inch, feet; inch = 0.3937 * centimeter; feet = 0.0328 * centimeter; System.out.printf(&apos;Inches is: %.2f 
&apos;, inch); System.out.printf(&apos;Feet is: %.2f&apos;, feet); return 0; } public static void main(String args []) { int centimeter = 20; Conversion_length(centimeter); } } 

Uitgang:

 Inches is: 7.87 Feet is: 0.656 

Programma 4: Schrijf een programma in Python voor het converteren van cm naar voet en inch.

 # This is a Python program which converts centimeter length to feet and Inches centimeter=int(input(&apos;Enter the height in centimeters:&apos;)) #convert centimeter to inches inches = 0.394 * centimeter #convert centimeter to feet feet = 0.0328 * centimeter print(&apos;The length in feet&apos;,round(feet,2)) print(&apos;The length in inches&apos;,round(inches,2)) 

Uitgang:

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