Thursday, May 1, 2008

Write a shell script to find distance between two cities.

echo “Enter the distance in kms”

read dist

expr ‘$meters= $dist\*1000’

expr ‘$centi = $meters\*100’

expr ‘$inch = $centi\*2.54’

expr ‘$feet = $inch\*12’

echo “Distance in meters = $meters”

echo “Distance in centimeter = $centi”

echo “Distance in inches = $inch”

echo “Distance in feets = $feet”

No comments: