四面体只是具有三角形底面的金字塔。它是一个具有四个三角形面,三个侧面或侧面,一个在底部或底部以及四个顶点或拐角的固体对象。如果面都是全等边三角形,则将四面体称为正则面。
四面体的面积可以使用以下公式找到:
Area = sqrt(3)*(side*side)
例子 :
Input : side = 3
Output : 15.5885
Input : side = 20
Output : 692.82
C++
// C++ Program to Calculate
// area of tetrahedron
#include
#include
using namespace std;
//Utility Function
double area_of_tetrahedron(int side)
{
return (sqrt(3)*(side*side));
}
//Driver Code
int main()
{
int side=3;
cout<< "Area of Tetrahedron ="
<< area_of_tetrahedron(side);
}
// This code is contributed by anant321.
Java
// Java Program to Calculate
// area of tetrahedron
import java.io.*;
import java.text.DecimalFormat;
class GFG
{
// Utility Function
static double area_of_tetrahedron(int side)
{
return (double)Math.round((Math.sqrt(3) *
(side * side)) * 10000d) / 10000d;
}
// Driver Code
public static void main(String args[])
{
int side = 3;
System.out.print("Area of Tetrahedron = " +
area_of_tetrahedron(side));
}
}
// This code is contributed by
// Manish Shaw(manishshaw1)
Python 3
# Python 3 Program to Calculate
# area of tetrahedron
import math
def area_of_tetrahedron(side):
return (math.sqrt(3) * (side * side))
# Driver Code
side = 3;
print("Area of Tetrahedron =",
area_of_tetrahedron(side));
# This code is contributed
# by Akanksha Rai
C#
// C# Program to Calculate
// area of tetrahedron
using System;
class GFG
{
// Utility Function
static double area_of_tetrahedron(int side)
{
return (Math.Sqrt(3) *
(side * side));
}
// Driver Code
static void Main()
{
int side = 3;
Console.Write("Area of Tetrahedron = " +
area_of_tetrahedron(side));
}
}
// This code is contributed by
// Manish Shaw(manishshaw1)
PHP
Javascript
Java
// java program to find the volume of a tetrahedron
import java.io.*;
class GFG {
// Function to calculate volume
static double vol_tetra(int side)
{
double volume = (Math.pow(side, 3) / (6 * Math.sqrt(2)));
return volume;
}
// Driver Code
public static void main (String[] args) {
int side = 3;
double vol = vol_tetra(side);
System.out.println( vol);
}
}
// This code is contributed by
// anuj_67..
Python 3
# Python 3 program to find the volume
# of a tetrahedron
import math
# Function to calculate volume
def vol_tetra(side):
volume = (pow(side, 3) / (6 * math.sqrt(2)))
return volume;
# Driver Code
if __name__ == "__main__":
side = 3
vol = vol_tetra(side)
print(round(vol, 2))
# This code is contributed by ita_c
C#
// C# program to find the volume
// of a tetrahedron
using System;
class GFG
{
// Function to calculate volume
static double vol_tetra(int side)
{
double volume = (Math.Pow(side, 3) /
(6 * Math.Sqrt(2)));
return volume;
}
// Driver Code
public static void Main ()
{
int side = 3;
double vol = vol_tetra(side);
Console.WriteLine( vol);
}
}
// This code is contributed by
// anuj_67..
PHP
Javascript
输出 :
Area of Tetrahedron =15.5885
另一种方法:
四面体的体积可通过以下公式求出:
Volume = a3/(6√2)
例子 :
Input : side = 3
Output : 3.18
Input : side = 20
Output : 942.81
Java
// java program to find the volume of a tetrahedron
import java.io.*;
class GFG {
// Function to calculate volume
static double vol_tetra(int side)
{
double volume = (Math.pow(side, 3) / (6 * Math.sqrt(2)));
return volume;
}
// Driver Code
public static void main (String[] args) {
int side = 3;
double vol = vol_tetra(side);
System.out.println( vol);
}
}
// This code is contributed by
// anuj_67..
的Python 3
# Python 3 program to find the volume
# of a tetrahedron
import math
# Function to calculate volume
def vol_tetra(side):
volume = (pow(side, 3) / (6 * math.sqrt(2)))
return volume;
# Driver Code
if __name__ == "__main__":
side = 3
vol = vol_tetra(side)
print(round(vol, 2))
# This code is contributed by ita_c
C#
// C# program to find the volume
// of a tetrahedron
using System;
class GFG
{
// Function to calculate volume
static double vol_tetra(int side)
{
double volume = (Math.Pow(side, 3) /
(6 * Math.Sqrt(2)));
return volume;
}
// Driver Code
public static void Main ()
{
int side = 3;
double vol = vol_tetra(side);
Console.WriteLine( vol);
}
}
// This code is contributed by
// anuj_67..
的PHP
Java脚本
输出 :
3.18
请参阅程序上的完整文章以计算四面体的面积和体积,以获取更多详细信息!
想要从精选的最佳视频中学习和练习问题,请查看《基础知识到高级C的C基础课程》。