In our childhood many of us used to hate mathematics where we need to calculate the areas of the different shapes.There we need to remember the formulas of each and every shape.Today we shall write the program to find area of square,rectangle,circle so that we can use them in future. We use the childhood formulas for calculation of area of above mentioned geometrical figures.
- For square side * side
- For rectangle lenght * breadth
- For circle 3.14 * radius * radius
The code is:
echo “Enter the side of the square:”
read s
echo “Enter the length and breadth of rectangle:”
read leng
read brea
echo “Enter the radius of the circle:”
read radius
echo “Area of the square is:` expr $s \* $s ` ”
echo “Area of the rectangle is: `expr $leng \* $brea`”
echo “Area of the circle is: `expr 3.14 \* radius \* radius`”
output:
Enter the side of the square:5
Enter the length and breadth of rectangle: 10 6
Enter the radius of the circle:8
Area of the square is:25
Area of the rectangle is:60
Area of the circle is:200.96