Program for Surface Area of Octahedron
Given the sides of Octahedron then calculate the surface area.
Examples:
Input : 7 Output : 169.741 Input : 9 Output : 280.59
An regular octahedron has eight faces, which are all in the shape of equilateral triangles.The area of an octahedron is 2 multiplied by the length of an edge squared multiplied by the square root of three.
Formula:
Surface area= 2*(sqrt(3))*(side*side)
C++
// CPP Program to calculate // surface area of Octahedron #include <bits/stdc++.h> using namespace std; // utility Function double surface_area_octahedron( double side) { return (2*( sqrt (3))*(side*side)); } // Driver Function int main() { double side = 7; cout << "Surface area of octahedron =" << surface_area_octahedron(side) << endl; } |
chevron_right
filter_none
Java
// Java Program to calculate // surface area of Octahedron. import java.io.*; import java.util.*; class GFG { // utility Function static double surface_area_octahedron( double side) { return ( 2 *(Math.sqrt( 3 ))*(side*side)); } public static void main (String[] args) { double side = 7 ; System.out.println( "Surface area of octahedron =" + surface_area_octahedron(side)); } } // This code is contributed by Gitanjali. |
chevron_right
filter_none
Python3
# Python Program to calculate # surface area of Octahedron. import math # utility Function def surface_area_octahedron( side): return ( 2 * (math.sqrt( 3 )) * (side * side)) # driver code side = 7 print ( "Surface area of octahedron =" , surface_area_octahedron(side)) # This code is contributed by Gitanjali. |
chevron_right
filter_none
C#
// C# program to calculate // surface area of Octahedron. using System; class GFG { // utility Function static double surface_area_octahedron( double side) { return (2 * (Math.Sqrt(3)) * (side * side)); } // Driver code public static void Main() { double side = 7; Console.WriteLine( "Surface area of octahedron =" + surface_area_octahedron(side)); } } // This code is contributed by vt_m. |
chevron_right
filter_none
PHP
<?php // PHP Program to calculate // surface area of Octahedron // utility Function function surface_area_octahedron( $side ) { return (2 * (sqrt(3)) * ( $side * $side )); } // Driver Code $side = 7; echo ( "Surface area of octahedron =" ); echo ( surface_area_octahedron( $side )); // This code is contributed by vt_m. ?> |
chevron_right
filter_none
Output:
Surface area of octahedron =169.741
Recommended Posts:
- Calculate Volume, Curved Surface Area and Total Surface Area Of Cylinder
- Program for Surface area of Dodecahedron
- Program for Volume and Surface Area of Cube
- Program for Volume and Surface Area of Cuboid
- Program to find the surface area of the square pyramid
- Program to calculate Volume and Surface area of Hemisphere
- Program to calculate the Surface Area of a Triangular Prism
- Program for Volume and Surface area of Frustum of Cone
- Program to find volume and surface area of pentagonal prism
- Find the Surface area of a 3D figure
- Calculate Volume and Surface area Of Sphere
- Surface Area and Volume of Hexagonal Prism
- Calculate volume and surface area of Torus
- Calculate volume and surface area of a cone
- Program to calculate volume of Octahedron
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 : vt_m