Thursday, May 1, 2008

The length and breadth of a rectangle and radius of a circle are input through the keyboard. Write a program to calculate the area and perimeter of th

# SS3

# Calculates the area and circumference of circle and rectangle

# Usage: SS3

echo Enter length, breadth and radius

read length breadth radius

areaR=‘expr $length \* $breadth‘

perimeterR=‘expr $length \* 2+ $breadth \* 2 ‘

areaC=‘echo 3.14 \* $radius \* $radius | bc ‘

cirC=‘echo 2 \* 3.14 \* $radius | bc‘

echo Area of rectangle = $areaR and perimeter = $perimeterR

echo Area of circle = $areaC and circumference = $cirC

No comments: