Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Program to convert and print this distance in meters, feet, inches and centimeters

Posted By: Harrison Evans     Category: Unix / Linux / Ubuntu     Views: 14670

The distance between two cities (in Km) is input through the keyboard. Write a program to convert and print this distance in meters, feet, inches and centimeters.

Code for Program to convert and print this distance in meters, feet, inches and centimeters in Unix / Linux / Ubuntu

echo "Enter distance between two cities (in km) : "
read km

meter=`echo $km \* 1000 | bc`
feet=`echo $meter \* 3.2808 | bc`
inches=`echo $feet \* 12 | bc`
cm=`echo $feet \* 30.48 | bc`

echo "Total meter is    : $meter "
echo "Total feet is     : $feet "
echo "Total inches is   : $inches "
echo "Total centimeters : $cm "
  
Share: 



Harrison Evans
Harrison Evans author of Program to convert and print this distance in meters, feet, inches and centimeters is from London, United Kingdom.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!