-----------------------------Script--------------------------- echo "Give Details of the Rectangle" echo -e "Enter Length : \c" read length echo -e "Enter Breadth : \c" read breadth area=`echo -e "scale=2 \n $length * $breadth" | bc` para=`echo -e "scale=2 \n 2 * ($length + $breadth)" | bc` echo "Area = " $area echo "Parameter = " $para echo "------------------------------" echo "Give details of the Circle" echo -e "Enter Radius : \c" read radius area=`echo -e "scale=2 \n $radius * $radius * 3.14" | bc` cirum=`echo -e "scale=2 \n $radius * 2 * 3.14" | bc` echo "Area = " $area echo "Circumference = " $cirum -----------------------------output--------------------------- Give Details of the Rectangle Enter Length : 2 Enter Breadth : 2 Area = 4 Parameter = 8 ------------------------------ Give details of the Circle Enter Radius : 10 Area = 314.00 Circumference = 62.80 -----------------------------END------------------------------
Home
Shell Script
The length and breadth of a rectangle and radius of a circle are entered through the keyboard. Calculate the perimeter and area of rectangle and area and circumference of the circle.
- Blogger Comment
- Facebook Comment
Subscribe to:
Post Comments
(
Atom
)
0 comments:
Post a Comment