# What is a polygon? | Area of Triangle in java

What is a polygon? | Area of Triangle in java

## What is a polygon?

A polygon is any 2-dimensional shape formed with straight lines. Triangles, quadrilateral, pentagon and hexagon are all examples of polygons.

A regular polygon is a polygon in which all sides of the polygon are of equal length.
We have a mathematical formula so that the area of ​​a regular polygon can be calculated.
Area = (ln * ln * n / 4 * (tan (180 / n))
Where
ln = Length of edge of polygon
Number of sides in a polygon =
tan = touch function in degrees

### Area of Triangle in Java

import java.io.*;
import java.util.*;
class Area
{
public static void main(String []args)
{
Scanner ob=new Scanner(System.in);
int l,h;
l=ob.nextInt();
h=ob.nextInt();
System.out.println(“enter value l and h”);
double t=0.5*l*h;
System.out.println(“Area of Triangle:”+t);

}
}

### Have any Question or Comment?

You have successfully subscribed to myprogrammingschool

There was an error while trying to send your request. Please try again.

My Programming School will use the information you provide on this form to be in touch with you and to provide updates and marketing.