×

Program to calculate the area of the circumcircle of an equilateral triangle

You have given one value which represents the side of the equilateral triangle. You have to find out the area of the circumcircle. Let’s take an example -

Program To Calculate The Area Of The Circumcircle Of An Equilateral Triangle

For the above diagram, we have an equilateral triangle named ABC. We have to find out the area of its circumcircle.

Input-

6

Output-

37.69

Explanation- 6 is the value of the side of an equilateral triangle. By calculating the area of the circumcircle, we get the answer 37.69.

Note: -

What is the equilateral triangle?

Triangle has three sides, and an equilateral triangle is a triangle whose three sides are equal. It means, according to the above diagram, the sides AB, BC, and CA are of the same length.

AB = BC = CA

What is the circumcircle?

A circumcircle is a special type of circle. For various types of polygons, we can get circumcircles. It is a circle which goes through every vertex of the polygon. We can calculate different properties of the circle by using different properties of the polygon. A circumcircle of an equilateral triangle goes through three vertices of the triangle.

Algorithm:-

Step 1: Start

Step 2: The value of the sides of a triangle is taken from the user

Step 3: A function is called to calculate the area.

Step 4: In this function, we take the input value, which represents the side of the triangle.

Step 5: The floating point variable is declared in function to store the area

Step 6: The area is calculated.

Step 7: The value of the calculated area is returned.

Step 8: The returned value will be printed.

Step 9: Stop.

Explanation of Algorithm: - Let's try to understand the algorithm by the above diagram. We have an equilateral triangle ABC whose each side is the same in length ( AB = BC = CA ). If we consider the point 'O' as the centre of the circle that goes through each vertex of the triangle, then the value of OA is the radius of the circle. From geometry, we know that the intersection point of all medians of a triangle is the centre of the circumcircle of the equilateral triangle. In this way, we can get the value of the radius of the circle based on the side of the triangle. So, radius = a/ ( root of 3 ).

The formula of area of circle is

Here r = a/

So, area =

Code: -

// Program in CPP to calculate the area of circum.
Circle of an equilateral triangle
#include <iostream>
#include <math.h>
using namespace std;
// function to calculate the area of circumcircle
// of equilateral triangle
float area_circumscribed(float a)
{
	return (a * a * (3.14 / 3));
}
// Driver code
int main()
{
	float a, Area;
	cin >> a;
	// function calling
	Area = area_circumscribed(a);
	// displaying the area
	cout << " The value of triangle side = " << a;
cout << “Area of CircumCircle = ”  << Area;
	return 0;
}

Program in C

// Program in c to calculate the area of circum
circle of an equilateral triangle
#include <stdio.h>
#define PI 3.14159265
// function to find area of
// circumscribed circle
float area_circumscribed(float a)
{
	return (a * a * (PI / 3));
}
// Driver code
int main()
{
	float a = 6;
	printf("Area of circumscribed circle is :%f",
			area_circumscribed(a));
	return 0;
}


Program in Java

// Program in java to calculate the area of the circum
circle of an equilateral triangle
import java. lang.*;
class jtp {	
	static double PI = 3.14159265;
	// function to find the area of
	// circumscribed circle
	public static double area_circumscribed(double a)
	{
		return (a * a * (PI / 3));
	}
	// Driver code
	public static void main(String[] args)
	{
		double a = 6.0;
		System.out.println("Area of circumscribed circle is :"
		+ area_circumscribed(a));
	}
}

Program in Python

// Program in python to calculate the area of the circum
circle of an equilateral triangle
PI = 3.14159265	
# Function to find the area of
# circumscribed circle
def area_circumscribed(a):
	return (a * a * (PI / 3))	
# Driver code
a = 6.0
print("Area of circumscribed circle is :%f"
       %area_circumscribed(a))

Output:

1.	 The value of triangle side = 6
Area of CircumCircle = 37.69
2.	The value of triangle side = 9
Area of CircumCircle = 84.82
3.	The value of triangle side = 3
Area of CircumCircle = 9.42

Complexity Analysis: -

Time complexity- Here, we need no recursion or looping so we can find the solution within constant time. Time complexity will be O (1).

Space complexity- In this solution, we use constant memory. So, space complexity will be O(1).


Related Topics

Understanding Data Processing

Introduction Data In our everyday lives, any task that we perform online is related to data. Millions of pieces of data are produced every second across the globe. Data production is largely...

4 minutes read.

Stack vs Queue: Data Structure

 Difference Between Stack and Queue What is Stack? The LIFO principle applies on insertion and deletion operations of the stack which means last inserted element to the stack will remove first....

3 minutes read.

Properties of Binary Tree

Trees are maybe of the most significant datum structures. They are used to store and figure out data. A binarytree is a tree data structure made from nodes, all of which has...

3 minutes read.

Tree terminology in Data structures

Data structures The storage used to organize and store data is known as a data structure, and it is a method where data can be arranged on a computer to be...

6 minutes read.

Operations on 2D-Arrays

Two Dimensional Array Operations Adding Elements to Two-D Arrays We must put data in both rows and columns when inserting items in 2-D Arrays. As a result, we employ the idea of...

10 minutes read.

Recursion - Factorial and Fibonacci

In this article, we will learn how to find the factorial of a number and the Fibonacci series up to n using the recursion method. What is recursion? Defining anything in terms...

7 minutes read.

Spanning Tree

Spanning Tree: The spanning tree is a subset of the graph. It is a non-cyclic graph. If any node in the spanning tree is truncated, the entire graph fails. There are...

10 minutes read.

Priority Queue in Data Structure

Priority Queue A priority queue is a special kind of queue, in priority queue we give some priority to an element and according to this priority an element can be served...

3 minutes read.

Introduction and Implementation of Bloom Filter

It often happens with many of us that when we create an account on some applications like Github, it shows us that the username already exists. You can add some...

4 minutes read.

Introduction to Arrays

What exactly is an array? A group of related data pieces stored in contiguous memory regions is referred to as an array. It is the most basic data structure in which...

5 minutes read.

Reverse the Singly Linked List in C

Reverse the Singly Linked List in C This article has given a singly linked list and will reverse the linked list by changing the links between nodes. Example:                         Input:  2 -> 4...

3 minutes read.

Common Operations on various Data Structures

Data structures are ways to organise data in computer memory for quick and effective use. The storage of data uses a variety of data-structures. It is also possible to define...

7 minutes read.

Applications of trees in data structures

Data structures Storage used to organize and store data is known as the data structure. It is a method of managing computerized data to translate or retrieve it more efficiently. A...

7 minutes read.

Structure and Union Data Structure

The array is used for the same type of data, but if we want to store a mixed type of data in a group, then the array cannot be used. The Structure...

4 minutes read.

Bubble Sort vs Quick Sort

In this article, we are going to compare two sorting techniques, Bubble sort and Quick Sort. In starting, we will first discuss the idea of sorting an array using bubble...

7 minutes read.

Hashing and its Applications

Hashing Hashing refers to transforming plain text data in such a way that even if it is leaked for some reason, no one would be able to make sense of it....

6 minutes read.

Burning binary tree

Burn the Binary tree starting from the target node You have given a binary tree and a target node value. Now you have to burn the tree from target node. You...

4 minutes read.

Finding the Maximum Element in a Binary Tree

Implementation // Creating a C++ program to excavate the minimum and maximum in a given binary tree. #include <bits/stdc++.h> #include <iostream> using namespace std; // creating a new tree node. class __nod { public: int record; __nod *Lft, *Rt; /*...

4 minutes read.

Complete Binary tree

In this article, we will discuss the complete binary tree. But before start discussing the complete binary tree, we should first see a brief description of a binary tree. What is...

7 minutes read.

Strings in Data Structures

Strings and functions in C A string is a collection of characters. We'll learn how to declare strings, operate with strings in C programming, and use pre-defined string handling routines. We'll look...

7 minutes read.