Program to find the Area and Volume of Icosahedron

Given the side of an Icosahedron. The task is to find the area and volume of the given Icosahedron.

Examples :

Input : a = 5
Output : Area: 216.506
         Volume: 272.712

Input : a = 10
Output : Area: 866.0254
         Volume: 2181.695

In geometry, an Icosahedron is a regular polyhedron which contains 20 identical equilateral triangular faces, 30 sides, and 12 vertices.



Area of Icosahedron

Formula to find Area and Volume of Icosahedron: Let a be the side of Icosahedron, then

Surface area of Icosahedron = 5\sqrt{3} a^{2}

and, Volume of Icosahedron = \frac{5}{12}\left ( 3 + \sqrt{5} \right )a^{3}

C++

filter_none

edit
close

play_arrow

link
brightness_4
code

// C++ program to find the Area and
// volume of Icosahedron
#include <bits/stdc++.h>
using namespace std;
  
// Function to find area of Icosahedron
float findArea(float a)
{
    float area;
  
    // Formula to calculating area
    area = 5 * sqrt(3) * a * a;
      
    return area;
}
  
// Function to find volume of Icosahedron
float findVolume(float a)
{
    float volume;
  
    // Formula to calculating volume
    volume = ((float)5 / 12) * (3 + sqrt(5)) * a * a * a;
      
    return volume;
}
  
// Driver Code
int main()
{
    float a = 5;
  
    // Function call to find area of Icosahedron.
    cout << "Area: " << findArea(a) << endl;
      
    // Function call to find volume of Icosahedron.
    cout << "Volume: " << findVolume(a);
  
    return 0;
}

chevron_right


Java

filter_none

edit
close

play_arrow

link
brightness_4
code

// Java program to find the Area and
// volume of Icosahedron
import java.io.*;
  
class GFG {
      
    // Function to find area of Icosahedron
    static float findArea(float a)
    {
        float area;
      
        // Formula to calculating area
        area = (float)(5 * Math.sqrt(3) * a * a);
          
        return area;
    }
      
    // Function to find volume of Icosahedron
    static float findVolume(float a)
    {
        float volume;
      
        // Formula to calculating volume
        volume = (float)(((float)5 / 12) * (3 + Math.sqrt(5)) * a * a * a);
          
        return volume;
    }
      
    // Driver code
    public static void main (String[] args)
    {
        float a = 5;
  
        // Function call to find area of Icosahedron.
        System.out.println("Area: " + findArea(a));
          
        // Function call to find volume of Icosahedron.
        System.out.println("Volume: " + findVolume(a));
    }
}

chevron_right


Python3

filter_none

edit
close

play_arrow

link
brightness_4
code

# Python3 program to 
# find the Area and
# volume of Icosahedron
  
# import math module 
# to use sqrt function
from math import sqrt
  
# Function to find 
# area of Icosahedron
def findArea(a):
  
    # Formula to calculate area
    area = 5 * sqrt(3) * a * a
    return area
  
# Function to find 
# volume of Icosahedron
def findVolume(a):
      
    # Formula to calculate volume
    volume = ((5 / 12) * 
              (3 + sqrt(5)) * 
               a * a * a)
    return volume
  
# Driver Code
a = 5
  
# Function call to 
# find area of Icosahedron.
print("Area: " , findArea(a))
      
# Function call to find
# volume of Icosahedron.
print("Volume: " , findVolume(a))
  
# This code is contributed
# by ihritik

chevron_right


C#

filter_none

edit
close

play_arrow

link
brightness_4
code

// C# program to find the Area and
// volume of Icosahedron
using System;
  
public class GFG {
      
    // Function to find area of Icosahedron
    static float findArea(float a)
    {
        float area;
      
        // Formula to calculating area
        area = (float)(5 * Math.Sqrt(3) * a * a);
          
        return area;
    }
      
    // Function to find volume of Icosahedron
    static float findVolume(float a)
    {
        float volume;
      
        // Formula to calculating volume
        volume = (float)(((float)5 / 12) * (3 + Math.Sqrt(5)) * a * a * a);
          
        return volume;
    }
      
    // Driver code
    static public void Main ()
    {
        float a = 5;
  
        // Function call to find area of Icosahedron.
        Console.WriteLine("Area: " + findArea(a));
          
        // Function call to find volume of Icosahedron.
        Console.WriteLine("Volume: " + findVolume(a));
        //Code
    }
}

chevron_right


PHP

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
// PHP program to find 
// the Area and volume 
// of Icosahedron
  
// Function to find area
// of Icosahedron
function findArea($a)
{
    $area;
  
    // Formula to 
    // calculating area
    $area = 5 * sqrt(3) * 
                $a * $a;
      
    return $area;
}
  
// Function to find 
// volume of Icosahedron
function findVolume($a)
{
    $volume;
  
    // Formula to 
    // calculating volume
    $volume = ((float)5 / 12) * 
                (3 + sqrt(5)) * 
                  $a * $a * $a;
      
    return $volume;
}
  
// Driver Code
$a = 5;
  
// Function call to find 
// area of Icosahedron.
echo "Area: " , findArea($a), "\n";
  
// Function call to find 
// volume of Icosahedron.
echo "Volume: " , findVolume($a);
  
// This code is contributed 
// by jit_t
?>

chevron_right


Output:

Area: 216.506
Volume: 272.712


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



Improved By : jit_t, ihritik



Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.