Shell script to display the area of the triangle

| June 10, 2011 | 0 Comments

Redhat Linux Script


echo -n “Enter base of a triangel: ”
read b

echo -n “Enter height of a triangle: ”
read h

#area=$(echo “scale=2;(1/2)* $b *$h”|bc)

area=$(echo “scale=2;(1/2) * $b *$h”|bc)

echo “Area of triangle is $area”

Tags: ,

Category: Shell Scripting

Leave a Reply

You must be logged in to post a comment.