Given here is an equilateral triangle of sidelength a which inscribes a square which in turn inscribes a reuleaux triangle. The task is to find the maximum possible area of this reuleaux triangle.
Examples:
Input : a = 5 Output : 3.79335 Input : a = 9 Output : 12.2905

Approach: We know that the side of the square inscribed within an equilateral triangle of side length
is, x = 0.464*a (Please refer here).
Also, in the reuleaux triangle, h = x.
So, Area of Reuleaux Triangle:
A = 0.70477*h2 = 0.70477*(0.464*a)2
Below is the implementation of the above approach:
C++
// C++ Program to find the biggest Reuleaux triangle// inscribed within in a square which in turn// is inscribed within an equilateral triangle#include <bits/stdc++.h>using namespace std;// Function to find the biggest reuleaux trianglefloat Area(float a){ // side cannot be negative if (a < 0) return -1; // height of the reuleaux triangle float x = 0.464 * a; // area of the reuleaux triangle float A = 0.70477 * pow(x, 2); return A;}// Driver codeint main(){ float a = 5; cout << Area(a) << endl; return 0;} |
Java
// Java Program to find the biggest Reuleaux triangle// inscribed within in a square which in turn// is inscribed within an equilateral triangleclass GFG{ // Function to find the biggest reuleaux trianglestatic float Area(float a){ // side cannot be negative if (a < 0) return -1; // height of the reuleaux triangle float x = 0.464f * a; // area of the reuleaux triangle float A = 0.70477f * (float)Math.pow(x, 2); return A;}// Driver codepublic static void main (String[] args){ float a = 5; System.out.println(String.format("%.5f", Area(a)));}}// This code is contributed by chandan_jnu |
Python3
# Python3 Program to find the biggest# Reuleaux triangle inscribed within# in a square which in turn is inscribed# within an equilateral triangleimport math as mt# Function to find the biggest# reuleaux triangledef Area(a): # side cannot be negative if (a < 0): return -1 # height of the reuleaux triangle x = 0.464 * a # area of the reuleaux triangle A = 0.70477 * pow(x, 2) return A# Driver codea = 5print(Area(a))# This code is contributed by# Mohit Kumar 29 |
C#
// C# Program to find the biggest Reuleaux// triangle inscribed within in a square// which in turn is inscribed within an// equilateral triangleusing System;class GFG{ // Function to find the biggest// reuleaux trianglestatic float Area(float a){ // side cannot be negative if (a < 0) return -1; // height of the reuleaux triangle float x = 0.464f * a; // area of the reuleaux triangle float A = 0.70477f * (float)Math.Pow(x, 2); return A;}// Driver codepublic static void Main (){ float a = 5; Console.WriteLine(String.Format("{0,0:#.00000}", Area(a)));}}// This code is contributed by Akanksha Rai |
PHP
<?php// PHP Program to find the biggest Reuleaux// triangle inscribed within in a square// which in turn is inscribed within an// equilateral triangle// Function to find the biggest// reuleaux trianglefunction Area($a){ // side cannot be negative if ($a < 0) return -1; // height of the reuleaux triangle $x = 0.464 * $a; // area of the reuleaux triangle $A = 0.70477 * pow($x, 2); return $A;}// Driver code$a = 5;echo Area($a) . "\n";// This code is contributed// by Akanksha Rai |
Javascript
<script>// Javascript Program to find the biggest Reuleaux triangle// inscribed within in a square which in turn// is inscribed within an equilateral triangle// Function to find the biggest reuleaux trianglefunction Area( a){ // side cannot be negative if (a < 0) return -1; // height of the reuleaux triangle let x = 0.464 * a; // area of the reuleaux triangle let A = 0.70477 * Math.pow(x, 2); return A;}// Driver code let a = 5; document.write( Area(a).toFixed(5));// This code contributed by Rajput-Ji</script> |
3.79335
Attention reader! Don’t stop learning now. Get hold of all the important mathematical concepts for competitive programming with the Essential Maths for CP Course at a student-friendly price. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.


