Q:

Program to Convert Inches to meter

belongs to collection: Miscellaneous Programs Examples

0

Here, we will learn how to convert the length value, which is given in Inches to the length in meter.

If we want to convert the value of Inches into meter value, then we have to use the following one formula from the given 2 formulas:

 

meter = Inches /39.37 or meter = Inches  * 0.0254  

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 value of Inches into meter.

#include<stdio.h>  
int main()   
{  
int Inches = 40;  
double meter;  
meter = Inches / 39.37;    
meter = Inches  * 0.0254;       //You have to use one formula for converting the value in Inches to the value in meter  
printf ("The Value of 40 Inches in meter is: %.3f \n", meter);   
return 0;  
}  

 

Output:

The value of 40 Inches in meter is: 1.016

 

Program 2: Write a Program in PHP for converting the value of Inches into meter.

<?php   
// This is a PHP program which converts the value of Inches into meter   
$Inches = 100;   
$meter = $Inches / 39.37;   
 $meter = $Inches  * 0.0254; //You have to use one formula for converting the value in Inches to the value in meter  
echo("The value of 100 Inches in meter is " . $meter . "\n");   
?>  

 

Output:

The value of 100 Inches in meter is: 2.54

 

Program 3: Write a Program in Java for converting the value of Inches into meter.

// This is a Java program which converts the value of Inches into meter  
import java.io.*;   
class convert {   
static double Conversion_Inches_to_meter(double Inches)   
{   
double meter;  
meter = Inches / 39.37;  meter = Inches  * 0.0254;//You have to use one formula for converting the value in Inches to the value in meter.  
System.out.printf("Value in meter is: %.3f \n", meter);   
return 0;   
}    
public static void main(String args [])   
{   
double Inches = 2.5;   
Conversion_Inches_to_meter(Inches);   
}  
}  

 

Output:

Value of given Inches in meter is: 0.064

 

Program 4: Write a Program in Python for converting the value of Inches into meter.

# This is a Python program which converts the value of Inches into meter  
  
Inches = int(input("Enter the length in Inches:"))   
meter = Inches / 39.37; or meter = Inches  * 0.0254; #You have to use one formula for converting the value in Inches to the value in meter  
  
print("The length in meter is",round(meter,3))  

 

Output:

Enter the length in Inches:88
The length in meter is 2.235

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
Program to Convert Inches to mm... >>
<< Program to Convert Feet to m...