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.

     
-----------------------------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------------------------------
SHARE

Milan Tomic

Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment