Find area of Icosahedron

Here given code implementation process.

//C Program
//Find area of Icosahedron
#include <stdio.h>

#include <math.h>
 //Calculate area of Icosahedron by given side
void icosahedron_area(double side)
{
	//Calculate Formula
	//5√3*(size*size)
	double area = 5 * sqrt(3) * (side * side);
	//Display the result of icosahedron area
	printf(" Icosahedron  [ Side : %lf ] ", side);
	printf("\n Area : %lf\n\n", area);
}
int main()
{
	//Test Cases  
	icosahedron_area(4);
	icosahedron_area(8);
	icosahedron_area(13.6);
	return 0;
}

Output

 Icosahedron  [ Side : 4.000000 ]
 Area : 138.564065

 Icosahedron  [ Side : 8.000000 ]
 Area : 554.256258

 Icosahedron  [ Side : 13.600000 ]
 Area : 1601.800587
// Java Program
// Find area of Icosahedron
class IcosahedronArea
{
	//Calculate area of Icosahedron by given side
	public void icosahedron_area(double side)
	{
		//Calculate Formula
		//5√3*(side²)
		double area = 5 * Math.sqrt(3) * (side * side);
		//Display the result of icosahedron area
		System.out.print(" Icosahedron [ Side : " + side + " ] ");
		System.out.print("\n Area : " + area + "\n\n");
	}
	public static void main(String[] args)
	{
		IcosahedronArea obj = new IcosahedronArea();
		//Test Cases  
		obj.icosahedron_area(4);
		obj.icosahedron_area(8);
		obj.icosahedron_area(13.6);
	}
}

Output

 Icosahedron [ Side : 4.0 ]
 Area : 138.56406460551017

 Icosahedron [ Side : 8.0 ]
 Area : 554.2562584220407

 Icosahedron [ Side : 13.6 ]
 Area : 1601.8005868396974
// C# Program
// Find area of Icosahedron
using System;
class IcosahedronArea
{
	//Calculate area of Icosahedron by given side
	public void icosahedron_area(double side)
	{
		//Calculate Formula
		//5√3*(side²)
		double area = 5 * Math.Sqrt(3) * (side * side);
		Console.Write(" Icosahedron [ Side : " + side + " ] ");
		Console.Write("\n Area : " + area + "\n\n");
	}
	public static void Main(String[] args)
	{
		IcosahedronArea obj = new IcosahedronArea();
		//Test Cases  
		obj.icosahedron_area(4);
		obj.icosahedron_area(8);
		obj.icosahedron_area(13.6);
	}
}

Output

 Icosahedron [ Side : 4 ]
 Area : 138.56406460551

 Icosahedron [ Side : 8 ]
 Area : 554.256258422041

 Icosahedron [ Side : 13.6 ]
 Area : 1601.8005868397
// C++ Program
// Find area of Icosahedron
#include<iostream>
#include <math.h>
using namespace std;
class IcosahedronArea
{
	public:
		//Calculate area of Icosahedron by given side
		void icosahedron_area(double side)
		{
			//Calculate Formula
			//5√3*(side²)
			double area = 5 * sqrt(3) *(side *side);
			cout << " Icosahedron [ Side : " << side << " ] ";
			cout << "\n Area : " << area << "\n\n";
		}
};
int main()
{
	IcosahedronArea obj =  IcosahedronArea();
	//Test Cases  
	obj.icosahedron_area(4);
	obj.icosahedron_area(8);
	obj.icosahedron_area(13.6);
	return 0;
}

Output

 Icosahedron [ Side : 4 ]
 Area : 138.564

 Icosahedron [ Side : 8 ]
 Area : 554.256

 Icosahedron [ Side : 13.6 ]
 Area : 1601.8
<?php
// Php Program
// Find area of Icosahedron
class IcosahedronArea
{
	//Calculate area of Icosahedron by given side
	public 	function icosahedron_area($side)
	{
		//Calculate Formula
		//5√3*(side²)
		$area = 5 * sqrt(3) *($side *$side);
		//Display the result of icosahedron area
		echo(" Icosahedron [ Side : ". $side ." ] ");
		echo("\n Area : ". $area ."\n\n");
	}
}

function main()
{
	$obj = new IcosahedronArea();
	//Test Cases  
	$obj->icosahedron_area(4);
	$obj->icosahedron_area(8);
	$obj->icosahedron_area(13.6);
}
main();

Output

 Icosahedron [ Side : 4 ]
 Area : 138.56406460551

 Icosahedron [ Side : 8 ]
 Area : 554.25625842204

 Icosahedron [ Side : 13.6 ]
 Area : 1601.8005868397
// Node Js Program
// Find area of Icosahedron
class IcosahedronArea
{
	//Calculate area of Icosahedron by given side
	icosahedron_area(side)
	{
		//Calculate Formula
		//5√3*(side²)
		var area = 5 * Math.sqrt(3) *(side *side);
		//Display the result of icosahedron area
		process.stdout.write(" Icosahedron [ Side : " + side + " ] ");
		process.stdout.write("\n Area : " + area + "\n\n");
	}
}

function main(args)
{
	var obj = new IcosahedronArea();
	//Test Cases  
	obj.icosahedron_area(4);
	obj.icosahedron_area(8);
	obj.icosahedron_area(13.6);
}
main();

Output

 Icosahedron [ Side : 4 ]
 Area : 138.56406460551017

 Icosahedron [ Side : 8 ]
 Area : 554.2562584220407

 Icosahedron [ Side : 13.6 ]
 Area : 1601.8005868396974
#  Python 3 Program
#  Find area of Icosahedron
import math
class IcosahedronArea :
	# Calculate area of Icosahedron by given side
	def icosahedron_area(self, side) :
		# Calculate Formula
		# 5√3*(side²)
		area = 5 * math.sqrt(3) * (side * side)
		# Display the result of icosahedron area
		print(" Icosahedron [ Side : ", side ," ] ", end = "")
		print("\n Area : ", area ,"\n\n", end = "")
	

def main() :
	obj = IcosahedronArea()
	# Test Cases  
	obj.icosahedron_area(4)
	obj.icosahedron_area(8)
	obj.icosahedron_area(13.6)


if __name__ == "__main__": main()

Output

 Icosahedron [ Side :  4  ]
 Area :  138.56406460551017

 Icosahedron [ Side :  8  ]
 Area :  554.2562584220407

 Icosahedron [ Side :  13.6  ]
 Area :  1601.8005868396974
#  Ruby Program
#  Find area of Icosahedron
class IcosahedronArea

	# Calculate area of Icosahedron by given side
	def icosahedron_area(side)
	
		# Calculate Formula
		# 5√3*(side²)
		area = 5 * Math.sqrt(3) * (side * side)
		# Display the result of icosahedron area
		print(" Icosahedron [ Side  :", side ," ] ")
		print("\n Area  :", area ,"\n\n")
	end
end
def main()

	obj = IcosahedronArea.new()
	# Test Cases  
	obj.icosahedron_area(4)
	obj.icosahedron_area(8)
	obj.icosahedron_area(13.6)
end
main()

Output

 Icosahedron [ Side  :4 ] 
 Area  :138.56406460551017

 Icosahedron [ Side  :8 ] 
 Area  :554.2562584220407

 Icosahedron [ Side  :13.6 ] 
 Area  :1601.8005868396974

// Scala Program
// Find area of Icosahedron
class IcosahedronArea
{
	//Calculate area of Icosahedron by given side
	def icosahedron_area(side: Double): Unit = {
		//Calculate Formula
		//5√3*(side²)
		var area: Double = 5 * Math.sqrt(3) * (side * side);
		//Display the result of icosahedron area
		print(" Icosahedron [ Side : " + side + " ] ");
		print("\n Area : " + area + "\n\n");
	}
}
object Main
{
	def main(args: Array[String]): Unit = {
		var obj: IcosahedronArea = new IcosahedronArea();
		//Test Cases  
		obj.icosahedron_area(4);
		obj.icosahedron_area(8);
		obj.icosahedron_area(13.6);
	}
}

Output

 Icosahedron [ Side : 4.0 ]
 Area : 138.56406460551017

 Icosahedron [ Side : 8.0 ]
 Area : 554.2562584220407

 Icosahedron [ Side : 13.6 ]
 Area : 1601.8005868396974
// Swift Program
// Find area of Icosahedron
import Foundation
class IcosahedronArea
{
	//Calculate area of Icosahedron by given side
	func icosahedron_area(_ side: Double)
	{
		//Calculate Formula
		//5√3*(side²)
		let area: Double = 5 * sqrt(3) * (side * side);
		//Display the result of icosahedron area
		print(" Icosahedron [ Side : ", side ," ] ", terminator: "");
		print("\n Area : ", area ,"\n\n", terminator: "");
	}
}
func main()
{
	let obj: IcosahedronArea = IcosahedronArea();
	//Test Cases  
	obj.icosahedron_area(4);
	obj.icosahedron_area(8);
	obj.icosahedron_area(13.6);
}
main();

Output

 Icosahedron [ Side :  4.0  ]
 Area :  138.56406460551

 Icosahedron [ Side :  8.0  ]
 Area :  554.256258422041

 Icosahedron [ Side :  13.6  ]
 Area :  1601.8005868397


Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment







© 2021, kalkicode.com, All rights reserved