Q:

Write a program to find the Area of an Icosahedron

belongs to collection: Miscellaneous Programs Examples

0

Before writing the program of calculating the area of an icosahedron in different programming languages, firstly we have to know about what is icosahedron and its area's formula.

What is Icosahedron?

Icosahedron is a regular convex polyhedron shape. This shape contains 30 sides, 12 vertices, and 20 identical equilateral triangles.

Area of Icosahedron

 

Area of Icosahedron = 5 * √3 * a * a  

Where, a is the side of an icosahedron.  

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program of calculating the area of an icosahedron in different Programming languages

Program 1: Write a Program in C language:

// This C program which uses a function to find the area of a icosahedron.  
#include <stdio.h>  
float find_Area_of_icosahedron(float a) // It is a function to find area   
{   
float Area_of_icosahedron;  
Area_of_icosahedron= 5 * sqrt(3) * a * a ; // It is a formula for calculating a area of icosahedron   
return (Area_of_icosahedron);   
}   
float main()   
{   
float side;  
printf("Enter the side of the icosahedron:");   
scanf("%f",&side);  
printf("Area of the icosahedron is: %f", find_Area_of_icosahedron(side));     
return 0;   
}   

 

Output of Above C program:

Enter the side of the icosahedron:5
Area of the icosahedron is: 216.506348

 

Program 2: Write a Program in Java language:

// This a  Java program which finds the area of a icosahedron.  
class findarea {   
static float find_Area_of_icosahedron(float a)   
{    
float Area_of_icosahedron;  
Area_of_icosahedron= (float) (5 * Math.sqrt(3) * a * a) ; // It is a formula for calculating the area of icosahedron   
return(Area_of_icosahedron);   
}   
// Driver method   
public static void main(String[] args)   
{   
float side = 3;   
System.out.println("The Area of a icosahedron is:");  
System.out.println(find_Area_of_icosahedron(side));   
}   
}  

 

Output of Above Java program:

The Area of a icosahedron is:
77.94228

 

Program 3: Write a Program in PHP programming language.

<?php   
// This a  PHP program which finds the area of a icosahedron.    
// Function to find area   
function find_Area_of_icosahedron($a)   
{     
$Area_of_icosahedron = 5 * sqrt(3) * $a * $a; // It is a formula which finds the area  and store the value in the area_of_icosahedron variable.   
return ($Area_of_icosahedron);   
}   
$side = 2.5;  
echo find_Area_of_icosahedron($side);   
?>  

 

Output of Above PHP program:

54.13

 

Program 4: Write a Program in Python programming language.

# This is a python program which finds the area of a icosahedron.   
from math import sqrt  
def find_Area_of_icosahedron(a):  
    return ( 5 * sqrt(3) * a * a ) # It is a formula which finds the value of area.  
# main code begins  
Side = 5  
print(find_Area_of_icosahedron(Side))  

 

Output of Above Python program:

216.506348

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Miscellaneous Programs Examples

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a program to find the Volume of Octahedron... >>
<< Write a program to find the Volume of Tetrahedron...