Program to find Area of Triangle in JAVA

Program Code:

//Program to find area of triangle.

public class AreaoftrianglePFS
{

public static void main(String[] args)
{
double area,s1,s2,s3,s;
s1=30;
s2=40;
s3=50;
s=(s1+s2+s3)/2;
area=Math.sqrt(s*(s-s1)*(s-s2)*(s-s3));
System.out.println(“Area of Triangle = “+ area);

}

}

Output :

Screenshot (7).png

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s