# Java Program to Find Area of Circumcircle of an Equilateral Triangle

In the previous article, we have seen Java Program to Find All the Angles of a Given Triangle

In this article we will discuss about how to Find Area of Circumcircle of an Equilateral Triangle  using Java programming language.

## Java Program to Find Area of Circumcircle of an Equilateral Triangle

Before jumping into the program directly, let’s first know how we can Find Area of Circumcircle of an Equilateral Triangle.

Explanation:

Circumcircle of an equilateral triangle is a circle inside an equilateral triangle that touches all the sides of the triangle.

Formula to Find Area of Circumcircle of an Equilateral Triangle: (π*side*side)/3

Example:

When side = 6

Area of circle: (π*side*side)/3

=> (3.14*6*6)/3

=> 37.68

Let’s see different ways to find area of circumcircle of an equilateral triangle.

### Method-1: Java Program to Find Area of Circumcircle of an Equilateral Triangle By Using Static Value

Approach:

1. Declare the value for side.
2. Then call the areaOfCircle() method by passing side as parameter.
3. In this method the area of the circumcircle will be calculated using the formula (side*side*pi)/3
4. Then print the result.

Program:

import java.util.Scanner;

public class Main
{
public static void main(String[] args)
{
// Static initialization of the side of the triangle
int side = 10;
System.out.println("The area of the circumcircle inside the triangle is: "+areaOfCircle(side));
}

// Function to find out the area of the circumcircle
static double areaOfCircle(int side)
{
double pi = 3.14;
return (side*side*pi)/3;
}
}

Output:

The area of the circumcircle inside the triangle is: 104.66666666666667

### Method-2: Java Program to Find Area of Circumcircle of an Equilateral Triangle By Using User Input Value

Approach:

1. Take user input the value for side.
2. Then call the areaOfCircle() method by passing side as parameter.
3. In this method the area of the circumcircle will be calculated using the formula (side*side*pi)/3
4. Then print the result.

Program:

import java.util.Scanner;

public class Main
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
// Asking the user for the side of the triangle
System.out.println("Enter the side of the equilateral triangle");
int side = scan.nextInt();
System.out.println("The area of the circumcircle inside the triangle is: "+areaOfCircle(side));
}

// Function to find out the area of the circumcircle
static double areaOfCircle(int side)
{
double pi = 3.14;
return (side*side*pi)/3;
}
}

Output:

Enter the side of the equilateral triangle
9
The area of the circumcircle inside the triangle is: 84.78

Interested in programming and want to excel in it by choosing the short ways. Then, practicing with the available Java Program list is mandatory.

Related Java Articles: