The distance between two cities is input through the keyboard (in km). Write a program to convert this distance into metres, feet, inches and centimeters and display the results.

-----------------------------Script---------------------------
echo -e  "Enter the Distance Between 2 cities : \c"
read distance
meter=`expr $distance \* 1000`
centi=`expr $meter \* 100`
inch=`echo -e "scale=2 \n $centi / 2.5" | bc`
feet=`echo -e "scale=2 \n $inch * 12" | bc`
echo "Meter = " $meter
echo "Centimeter = " $centi
echo "Inch = " $inch
echo "Feet = " $feet
-----------------------------output---------------------------
Enter the Distance Between 2 cities : 2
Meter =  2000
Centimeter =  200000
Inch =  80000.00
Feet =  960000.00
-----------------------------END------------------------------ 
SHARE

Milan Tomic

Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment