Q:

Program to Convert Feet to cm

belongs to collection: Miscellaneous Programs Examples

0

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

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

cm = 30.48 * feet.

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

#include<stdio.h>  
int main()   
{  
int feet = 40;  
double centimeter;  
centimeter = 30.48 * feet;  
printf ("Value in Centimeter is: %.2f \n", centimeter);   
return 0;  
}  

 

Output:

Value in Centimeter is: 1219.2

 

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

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

 

Output:

Value in Centimeter is: 304.8

 

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

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

 

Output:

Value in Centimeter is: 609.6 

 

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

# This is a Python program which converts the value of feet into cm   
      
feet=int(input("Enter the length in feet:"))   
#convert feet to cm  
centimeter  = 30.48 * feet;    
     
print("The length in centimeter",round(centimeter,2))  

 

Output:

Enter the length in feet: 55
The length in centimeter 1676.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 cm to Feet and Inches... >>