Algorithm
Step 1 : Start
Step 2 : Read fahrenheit value
Step 3 : Convert fahrenheit to centigrade using the formulae: (fahrenheit – 32) × 5/9
Step 4 : Print centigrade
Step 5 : Stop
Program (degconv.sh)
# Degree conversion
echo -n "Enter Fahrenheit : "
read f
c=`expr \( $f - 32 \) \* 5 / 9`
echo "Centigrade is : $c"
Output
[vijai@localhost simple]$ sh degconv.sh
Enter Fahrenheit : 213
Centigrade is : 100
Step 1 : Start
Step 2 : Read fahrenheit value
Step 3 : Convert fahrenheit to centigrade using the formulae: (fahrenheit – 32) × 5/9
Step 4 : Print centigrade
Step 5 : Stop
Program (degconv.sh)
# Degree conversion
echo -n "Enter Fahrenheit : "
read f
c=`expr \( $f - 32 \) \* 5 / 9`
echo "Centigrade is : $c"
Output
[vijai@localhost simple]$ sh degconv.sh
Enter Fahrenheit : 213
Centigrade is : 100
No comments:
Post a Comment