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;
System.out.println(“Area of Triangle = “+ area);



Output :

Screenshot (7).png


Program to find Area of Circle in java.

Program Code:

// Program to find the area of circle.
public class AreaofcirclePFS

public static void main(String[] args)
double circle_radius=20;        //Radius Given
double pi=3.14159;                //Value of PI
double circle_area=pi*circle_radius*circle_radius;
System.out.println(“\n Area of Circle is = “+ circle_area);




Screenshot (6).png

Writing and Running Your Program in Java

1.Launch or Run  Eclipse.

2. Go to Eclipse Eclipse menu bar,choose File⇒New⇒Java Project

A New Java Project dialog box appears

3.In the New Java Project Dialog box,type a name for your new project and then click Finish.                                                          Screenshot (3).png

4.Select your project in the Package Explorer.

5.From  Eclipse’s main menu,choose File⇒New⇒Class    

6.In the New Java Class Dialog box Name field,type the name of your new class.  

  Put a check mark in the public static void main(String[]args) checkbox.   

7.Click Finish.                                                                              


Screenshot (5)