Program 1: Write a Program in C for converting the value of Inches into cm.
#include<stdio.h>
int main()
{
int inches = 40;
double centimeter;
centimeter = 2.54 * Inches;
printf ("Value in Centimeter is: %.2f \n", centimeter);
return 0;
}
Output:
Value in Centimeter is: 101.6
Program 2: Write a Program in PHP for converting the value of Inches into cm.
<?php
// This is a PHP program which converts the value of Inches into the value of cm
$Inches = 10;
$centimeter = 2.54 * $Inches;
echo("Value of 10 inches in Centimeter is " . $centimeter . "\n");
?>
Output:
Value of 10 inches in Centimeter is: 25.4
Program 3: Write a Program in Java for converting the value of Inches into cm.
// This is a Java program which converts the value of Inches into cm
import java.io.*;
class convert {
static double Conversion_Inches_to_cm(int Inches)
{
double centimeter;
centimeter = 2.54 * Inches;
System.out.printf("Value in Centimeter is: %.2f \n", centimeter);
return 0;
}
public static void main(String args [])
{
int Inches = 20;
Conversion_Inches_to_cm(Inches);
}
}
Output:
Value in Centimeter is: 50.8
Program 4: Write a Program in Python for converting the value of Inches into cm.
# This is a Python program which converts the value of Inches into cm
Inches=int(input("Enter the length in Inches:"))
#convert Inches to cm
centimeter = 2.54 * Inches;
print("The length in centimeter",round(centimeter,2))
Output:
Enter the length in Inches: 24
The length in centimeter 60.96
Program 1: Write a Program in C for converting the value of Inches into cm.
Output:
Value in Centimeter is: 101.6
Program 2: Write a Program in PHP for converting the value of Inches into cm.
Output:
Value of 10 inches in Centimeter is: 25.4
Program 3: Write a Program in Java for converting the value of Inches into cm.
Output:
Value in Centimeter is: 50.8
Program 4: Write a Program in Python for converting the value of Inches into cm.
Output:
Enter the length in Inches: 24 The length in centimeter 60.96