Program to find the area of a triangle

Explanation

Three sided polygon is known as Triangle. It has a base and an altitude(height).

Area of Triangle = ½(b × h) where b is base and h is height.

Algorithm

  1. Define base and height
  2. Apply in the formula.
  3. Print the Area.

Complexity

O(1)


Solution

Python

Output:

Area of Triangle is:  30.0

C

Output:

Area of Triangle is: 32.50000

JAVA

Output:

Area of Triangle is: 26.0

C#

Output:

Area of Triangle is: 57.5

PHP

Output:

Area of Triangle is: 37.5

Next Topic#




Latest Courses