C++ program to find the Area of the circumcircle of any triangles with sides given?

To calculate the area of circumcircle of any triangles. We need to learn about basic concepts related to the problem.

Triangle − A closed figure with three sides.

Circle − A closed figure with infinite number or side or no sides.

A circle that encloses other figure inside it is a circumcircle.

A circumcircle touches the triangle from all its points. Lets say its sides are a, b, c then the radius of the circumcircle is given by the mathematical formula −

r = abc / (√((a+b+c))(a+b-c)(a+c-b)(b+c-a)))

The area of the circle with radius r is

area = 2 * (pie) * r *r.

Let’s take a few examples for this concept −

Sides of triangle : a = 4 , b = 5 , c =3

Area = 314

Example

Live Demo

#include <iostream>
#include <math.h>
using namespace std;
int main() {
float a = 7, b = 9, c = 13;
if (a < 0 || b < 0 || c < 0)
cout<<"The figure is not a triangle";
float p = (a + b + c) / 2;
float r = (a*b*c)/ (sqrt(p * (p - a) * (p - b) * (p - c)));
float area = 3.14 * pow(r, 2);
cout<<"The area is "<<area;
return 0;
}

Output

The area is 2347.55