Q:

Program to Convert Inches to mm

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 millimeter.

If we want to convert the value of Inches into the millimeter value, then we have to use the following formula:

 

millimeter = 25.4 * Inches.

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 millimeter.

#include<stdio.h>  
int main()   
{  
int Inches = 25;  
double millimeter;  
millimeter = 25.4 * Inches; //This formula converts the value of inches into millimeter.  
printf ("Value of 25 inches in millimeter is: %.2f \n", millimeter);   
return 0;  
}  

 

Output:

Value of 25 inches in millimeter is: 635.00

 

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

<?php   
// This is a PHP program which converts the value of Inches into millimeter   
$Inches = 500;   
$millimeter = 25.4 * $Inches; //This formula converts the value of inches into millimeter.  
echo("Value of 500 inches in millimeter is: " . $millimeter . "\n");   
?>  

 

Output:

Value of 500 inches in millimeter is: 12700

 

Program 3: Write a Program in Java for converting the value given in Inches into value in millimeter.

// This is a Java program which converts the value of Inches into millimeter  
import java.io.*;   
class convert {   
static double Conversion_Inches_to_millimeter(int Inches)   
{   
double millimeter;  
millimeter  = 25.4 * Inches;  //This formula converts the value of inches into millimeter.  
System.out.printf("Value of 8 inches in millimeter is: %.2f \n", millimeter);   
return 0;   
}    
public static void main(String args [])   
{   
int Inches = 8;   
Conversion_Inches_to_millimeter(Inches);   
}  
}  

 

Output:

Value of 8 inches in millimeter is: 203.2

 

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

# This is a Python program which converts the value of Inches into millimeter  
  
Inches=int(input("Enter the length in Inches:"))   
#convert Inches to millimeter  
millimeter  = 25.4 * Inches;  #//This formula converts the value of inches into millimeter.  
  
print("The length in millimeter",round(millimeter,2))  

 

Output:

Enter the length in Inches: 1
The length in millimeter 25.4

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