Given the side of an octahedron and the task is to calculate the volume and surface area of an octahedron for the given side in python.

**Octahedron :**

A regular octahedron has eight faces, all of which are equilateral triangles. An octahedron’s area is equal to 2 multiplied by the length of an edge squared multiplied by the square root of three.

Formulas:Surface Area of an Octahedron = 2*(sqrt(3))*(side*side)

The volume of an Octahedron = √2/3 × side

^{3}

**Examples:**

**Example1:**

**Input:**

Given side = 5

**Output:**

The Surface Area of an octahedron for the given side { 5 } = 86.60254037844386 The volume of an Octahedron for the given side { 5 } = 58.92556509887897

**Example2:**

**Input:**

Given side = 10

**Output:**

The Surface Area of an octahedron for the given side { 10 } = 346.41016151377545 The volume of an Octahedron for the given side { 10 } = 471.40452079103176

## Program for Volume and Surface Area of Octahedron in Python

Below are the ways to calculate the volume and surface area of an octahedron for the given side in python:

### Method #1: Using Mathematical Formula (Static Input)

**Approach:**

- Import math module using the import keyword.
- Give the side as static input and store it in a variable.
- Calculate the surface area of an octahedron using the above given mathematical formula and math.sqrt() function.
- Store it in another variable.
- Calculate the volume of an octahedron using the above given mathematical formula and math.sqrt() function.
- Store it in another variable.
- Print the surface area of a given octahedron.
- Print the volume of a given octahedron.
- The Exit of the Program.

**Below is the implementation:**

# Import math module using the import keyword. import math # Give the side as static input and store it in a variable. gvn_side = 5 # Calculate the surface area of an octahedron using the above given mathematical # formula and math.sqrt() function. # Store it in another variable. surfce_area = (2*(math.sqrt(3))*(gvn_side*gvn_side)) # Calculate the volume of an octahedron using the above given mathematical formula # and math.sqrt() function. # Store it in another variable. rslt_volum = ((gvn_side*gvn_side*gvn_side)*(math.sqrt(2)/3)) # Print the surface area of a given octahedron. print( "The Surface Area of an octahedron for the given side {", gvn_side, "} = ", surfce_area) # Print the volume of a given octahedron. print( "The volume of an Octahedron for the given side {", gvn_side, "} = ", rslt_volum)

#include <iostream> #include<math.h> using namespace std; int main() { double gvn_side = 5; double surfce_area = ( 2 * ( sqrt ( 3 ) ) * ( gvn_side * gvn_side ) ); double rslt_volum = ( ( gvn_side * gvn_side * gvn_side ) * ( sqrt ( 2 ) / 3 ) ); cout << "The Surface Area of an octahedron for the given side {" << gvn_side << "} = " << surfce_area << endl; cout << "The volume of an Octahedron for the given side {" << gvn_side << "} = " << rslt_volum << endl; }

**Output:**

The Surface Area of an octahedron for the given side { 5 } = 86.60254037844386 The volume of an Octahedron for the given side { 5 } = 58.92556509887897

### Method #2: Using Mathematical Formula (User Input)

**Approach:**

- Import math module using the import keyword.
- Give the side as user input using the int(input()) function and store it in a variable.
- Calculate the surface area of an octahedron using the above given mathematical formula and math.sqrt() function.
- Store it in another variable.
- Calculate the volume of an octahedron using the above given mathematical formula and math.sqrt() function.
- Store it in another variable.
- Print the surface area of a given octahedron.
- Print the volume of a given octahedron.
- The Exit of the Program.

**Below is the implementation:**

# Import math module using the import keyword. import math # Give the side as user input using the int(input()) function and store it in a variable. gvn_side = int(input("Enter some random number = ")) # Calculate the surface area of an octahedron using the above given mathematical # formula and math.sqrt() function. # Store it in another variable. surfce_area = (2*(math.sqrt(3))*(gvn_side*gvn_side)) # Calculate the volume of an octahedron using the above given mathematical formula # and math.sqrt() function. # Store it in another variable. rslt_volum = ((gvn_side*gvn_side*gvn_side)*(math.sqrt(2)/3)) # Print the surface area of a given octahedron. print( "The Surface Area of an octahedron for the given side {", gvn_side, "} = ", surfce_area) # Print the volume of a given octahedron. print( "The volume of an Octahedron for the given side {", gvn_side, "} = ", rslt_volum)

**Output:**

Enter some random number = 10 The Surface Area of an octahedron for the given side { 10 } = 346.41016151377545 The volume of an Octahedron for the given side { 10 } = 471.40452079103176