Q:

Program to Convert m to Feet and Inches

belongs to collection: Miscellaneous Programs Examples

0

In this article, we will learn how to convert the length, which is given in meter to the length in feet and inches value.

Following are the two formulas which help us to convert the value in meter to the value in feet and inches:

  1. 1 meter = 39.37inch
  2. 1 meter = 3.281feet

By using above formulas, we find the following two formulas:

  1. inch = 39.37 * meter (m)
  2. feet = 3.281 * meter (m)

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program 1: Write a Program in C for converting the meter to feet and inches.

#include<stdio.h>  
int main()   
{  
int meter = 40;  
double inch, feet;  
inch = 39.37 * meter;  
feet = 3.281 * meter;  
printf ("The value of 40 meter in Inches is: %.2f \n", inch);   
printf ("The value of 40 meter in feet is: %.2f", feet);   
return 0;  
}  

 

Output:

The value of 40 meter in Inches is:  1574.80
The value of 40 meter in feet is: 131.24

 

Program 2: Write a Program in PHP for converting the meter to feet and inches.

<?php   
// This is a PHP program which converts the meter length to feet and Inches   
$cen = 10;   
$inch = 39.37 * $cen;   
$feet = 3.281 * $cen;   
echo("The value of 10 meter in Inches is: " . $inch . "\n");   
echo("The value of 10 meter in Feet is: " . $feet);    
?>  

 

Output:

The value of 10 meter in Inches is: 393.7
The value of 10 meter in Feet is: 32.81

 

Program 3: Write a Program in Java for converting meter to feet and inches.

// This is a Java program which converts meter length to feet and Inches   
import java.io.*;   
class convert {   
static double Conversion_length(double meter)   
{   
double inch, feet;  
inch  = 39.37 * meter;   
feet = 3.281 * meter;   
System.out.printf("The value of 20 meter in Inches is: %.2f \n", inch);   
System.out.printf("The value of 20 meter in Feet is: %.2f", feet);   
return 0;   
}    
public static void main(String args [])   
{   
Double meter = 20;   
Conversion_length(meter);   
}  
}  

 

Output:

The value of 20 meter in Inches is: 787.40
The value of 20 meter in Feet is: 65.62

 

Program 4: Write a Program in Python for converting meter to feet and inches.

# This is a Python program which converts meter length to feet and Inches   
  
meter=int(input("Enter the height in meters:"))   
#convert meter to inche  
inches = 39.37 * meter  
#convert meter to feet  
feet = 3.281 * meter  
  
print("The length in feet",round(feet,2))  
print("The length in inches",round(inches,2))  

 

Output:

Enter the height in meters: 167
The length in feet 547.93
The length in inches 6574.79

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Miscellaneous Programs Examples

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a program to calculate the Perimeter of a Rh... >>
<< Program to Convert Inches to mm...