Q:

Program to Convert centimeter to millimeter

belongs to collection: Miscellaneous Programs Examples

0

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

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

 

1mm = 10 cm   

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

#include<stdio.h>  
int main()   
{  
double value_in_cm = 40.8;  
double millimeter;  
millimeter = value_in_cm * 10;  
printf ("Value in millimeter is: %.2f \n", millimeter);   
return 0;  
}  

 

Output:

Value in millimeter is: 408.00

 

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

<?php   
// This is a PHP program which converts the value of cm into the value of millimeter   
$cm = 105;   
$millimeter = $cm * 10;   
echo("Value of 100 cm in millimeter is " . $millimeter . "\n");   
?>  

 

Output:

Value of 105 cm in millimeter is 1050

 

Program 3: Write a Program in Java for converting the value of cm into millimeter.

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

 

Output:

Value in millimeter is: 15.00

 

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

# This is a Python program which converts the value of cm into millimeter  
  
cm = int(input("Enter the length in cm:")) // Takes the input from user.   
#convert cm to millimeter  
millimeter = cm * 10;    
  
print("The length in millimeter",round(millimeter,2))  

 

Output:

Enter the length in cm: 250
The length in millimeter 2500

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 centimeter to meter... >>
<< Write a program to find the Volume of the Rectangu...