Headlines
Loading...
Program in UNIX to convert Kilometers and print this distance in meters, feet, inches and centimeters.

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

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.

echo -n "Enter distance in km : "
read km
m=`echo $km \* 1000 |bc`
cm=`echo $m \* 100 |bc`
ft=`echo $cm / 30 |bc`
in=`echo $cm / 2.5 |bc`
echo "Distance in meters : $m"
echo "Distance in feets  : $ft"
echo "Distance in inches : $in"
echo "Distance in centimeters : $cm"
*** PLEASE checkout the Best deals from for top sites like Amazon, Flipkart etc ***