十二面体表面积计算程序

给定十二面体的边,计算其表面积。表面积是形状的所有面占用的空间量。 公式: mathbf{A=3sqrt{25+10sqrt{5}}hspace{2 mm} a^{2}}  例如:

null
Input : 3Output : 185.812Input : 7Output : 1011.64

A. 十二面体 是由12个面或平面组成的三维图形。所有的面都是大小相同的五边形。“十二面体”一词来源于希腊语dodeca(“十二”)和hedron(“脸”)。每种形状都有属性和特征。十二面体也是如此

  • 12个相等的五边形面
  • 20个顶点
  • 30边

其中五角大楼是一个二维形状,有5条直边和5个顶点。十二面体有12个这样的平面,相等的五边形面。所以你可以把十二面体想象成一个12面骰子(通常看不到),但也可以在一个战斗球棋盘游戏中。

C++

// CPP program to calculate
// surface area of dodecahedron
#include <bits/stdc++.h>
using namespace std;
// utility Function
double area_of_dodecahedron( int side)
{
return ((3 * sqrt (25 + 10 * ( sqrt (5))))
* ( pow (side, 2))) ;
}
// Driver Function
int main()
{
int side = 3;
cout<< "Surface area of dodecahedron = "
<< area_of_dodecahedron(side);
return 0;
}


JAVA

//Java program to calculate
// surface area of dodecahedron
class GFG
{
// Utility Function
static double area_of_dodecahedron( int side)
{
return (( 3 * Math.sqrt( 25 + 10 * (Math.sqrt( 5 ))))
* (Math.pow(side, 2 ))) ;
}
// Driver Function
public static void main (String[] args)
{
int side = 3 ;
System.out.println( "Surface area of dodecahedron ="
+ area_of_dodecahedron(side));
}
}
// This code is contributed by Azkia Anam.


Python3

# Python program to calculate
# surface area of dodecahedron
import math
# utility Function
def area_of_dodecahedron(side):
return (( 3 * math.sqrt( 25 + 10 * (math.sqrt( 5 )))) * (math. pow (side, 2 )))
# Driver Function
side = 3
print ( "Surface area of dodecahedron = " ,
round (area_of_dodecahedron(side), 3 ))
# This code is contributed
# by Azkia Anam.


C#

//C# program to calculate
// surface area of dodecahedron
using System;
class GFG
{
// Utility Function
static float area_of_dodecahedron( int side)
{
return ( float )((3 * Math.Sqrt(25 + 10 * (Math.Sqrt(5))))
* (Math.Pow(side, 2))) ;
}
// Driver Function
public static void Main ()
{
int side = 3;
Console.WriteLine( "Surface area of dodecahedron ="
+ area_of_dodecahedron(side));
}
}
// This code is contributed by vt_m.


PHP

<?php
// PHP program to calculate
// surface area of dodecahedron
// utility Function
function area_of_dodecahedron( $side )
{
return ((3 * sqrt(25 + 10 * (sqrt(5))))
* (pow( $side , 2))) ;
}
// Driver Code
$side = 3;
echo ( "Surface area of dodecahedron = " );
echo (area_of_dodecahedron( $side ));
// This code is contributed by vt_m.
?>


Javascript

<script>
// Javascript program to calculate
// surface area of dodecahedron
// utility Function
function area_of_dodecahedron( side)
{
return ((3 * Math.sqrt(25 + 10 * (Math.sqrt(5))))
* (Math.pow(side, 2))) ;
}
// Driver Code
let side = 3;
document.write( "Surface area of dodecahedron = "
+ Math.round(area_of_dodecahedron(side)*1000)/1000);
</script>


输出:

Surface area of dodecahedron = 185.812

© 版权声明
THE END
喜欢就支持一下吧
点赞13 分享