Thursday, May 1, 2008

The distance between two cities (in km) is input from the keyboard. Write a program to convert and print the distance in meters, feet, inches and cent

# SS2

# Finds distance between two cities

# Usage : SS2

echo Enter the distance in kilometers

read dist

meters=‘expr $dist \* 1000‘

centi=‘expr $metert \* 100‘

inches=‘expr $centi / 2.54 | bc‘

feet=‘expr $inches / 12 | bc‘

echo Distance in meters = $meters

echo Distance in Centimeters = $centi

echo Distance in inches = $inches

echo Distance in feet = $feet

No comments: