This article is about the surface and mathematical concept of a torus.

A 3D shape made by revolving a small circle (radius r) along a line made by a bigger circle (radius R).

**Property:**

- It can be made by revolving a small circle (radius r) along a line made by a bigger circle (radius R).
- It is not a polyhedron
- It has no vertices or edges

**Surface Area**

The surface area of a Torus is given by the formula –Surface Area = 4 × Pi^2 × R × r

Where r is the radius of the small circle and R is the radius of bigger circle and Pi is constant Pi=3.14159.

**Volume**

The volume of a cone is given by the formula –Volume = 2 × Pi^2 × R × r^2

Where r is the radius of the small circle and R is the radius of bigger circle and Pi is constant Pi=3.14159.

**Examples:**

Input : r=3, R=7 Output : Volume: 1243.568195 Surface: 829.045464

## C++

`// C++ program to calculate volume ` `// and surface area of Torus ` `#include<bits/stdc++.h> ` `using` `namespace` `std; ` ` ` `int` `main() ` `{ ` ` ` `// radus of inner circle ` ` ` `double` `r = 3; ` ` ` ` ` `// distance from origin to center of inner circle ` ` ` `// radius of black circle in figure ` ` ` `double` `R = 7; ` ` ` ` ` `// Value of Pi ` ` ` `float` `pi = (` `float` `)3.14159; ` ` ` `double` `Volume = 0; ` ` ` `Volume = 2 * pi * pi * R * r * r; ` ` ` `cout<<` `"Volume: "` `<<Volume<<endl; ` ` ` ` ` `double` `Surface = 4 * pi * pi * R * r; ` ` ` `cout<<` `"Surface: "` `<<Surface<<endl; ` `} ` |

*chevron_right*

*filter_none*

## C

`// C program to calculate volume ` `// and surface area of Torus ` `#include <stdio.h> ` `int` `main() ` `{ ` ` ` `// radus of inner circle ` ` ` `double` `r = 3; ` ` ` ` ` `// distance from origin to center of inner circle ` ` ` `// radius of black circle in figure ` ` ` `double` `R = 7; ` ` ` ` ` `// Value of Pi ` ` ` `float` `pi = (` `float` `)3.14159; ` ` ` `double` `Volume = 0; ` ` ` `Volume = 2 * pi * pi * R * r * r; ` ` ` `printf` `(` `"Volume: %f"` `, Volume); ` ` ` ` ` `double` `Surface = 4 * pi * pi * R * r; ` ` ` `printf` `(` `"\nSurface: %f"` `, Surface); ` `} ` |

*chevron_right*

*filter_none*

## Java

`// Java program to calculate volume ` `// and surface area of Torus ` `class` `Test { ` ` ` ` ` `public` `static` `void` `main(String args[]) ` ` ` `{ ` ` ` ` ` `// radius of inner circle ` ` ` `double` `r = ` `3` `; ` ` ` ` ` `// distance from origin to center of inner circle ` ` ` `// radius of black circle in figure ` ` ` `double` `R = ` `7` `; ` ` ` ` ` `// Value of Pi ` ` ` `float` `pi = (` `float` `)` `3.14159` `; ` ` ` `double` `Volume = ` `0` `; ` ` ` `Volume = ` `2` `* pi * pi * R * r * r; ` ` ` `System.out.printf(` `"Volume: %f"` `, Volume); ` ` ` ` ` `double` `Surface = ` `4` `* pi * pi * R * r; ` ` ` `System.out.printf(` `"\nSurface: %f"` `, Surface); ` ` ` `} ` `} ` |

*chevron_right*

*filter_none*

## Python3

`# Python3 program to calculate volume ` `# and surface area of Torus ` `# radus of inner circle ` `r ` `=` `3` ` ` `# distance from origin to center of inner circle ` `# radius of black circle in figure ` `R ` `=` `7` ` ` `# Value of Pi ` `pi ` `=` `3.14159` `Volume ` `=` `(` `float` `)(` `2` `*` `pi ` `*` `pi ` `*` `R ` `*` `r ` `*` `r); ` `print` `(` `"Volume: "` `, Volume); ` `Surface ` `=` `(` `float` `)(` `4` `*` `pi ` `*` `pi ` `*` `R ` `*` `r); ` `print` `(` `"Surface: "` `, Surface); ` |

*chevron_right*

*filter_none*

## C#

`// C# program to calculate volume ` `// and surface area of Torus ` `using` `System; ` ` ` `class` `GFG ` `{ ` ` ` `// Driver Code ` `public` `static` `void` `Main() ` `{ ` ` ` ` ` `// radius of inner circle ` ` ` `double` `r = 3; ` ` ` ` ` `// distance from origin to center ` ` ` `// of inner circle radius of black ` ` ` `// circle in figure ` ` ` `double` `R = 7; ` ` ` ` ` `// Value of Pi ` ` ` `float` `pi = (` `float` `)3.14159; ` ` ` `double` `Volume = 0; ` ` ` `Volume = 2 * pi * pi * R * r * r; ` ` ` `Console.WriteLine(` `"Volume: {0}"` `, Volume); ` ` ` ` ` `double` `Surface = 4 * pi * pi * R * r; ` ` ` `Console.WriteLine(` `"Surface: {0}"` `, Surface); ` `} ` `} ` ` ` `// This code is contributed by Soumik ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// PHP program to calculate volume ` `// and surface area of Torus ` ` ` `// radus of inner circle ` `$r` `= 3; ` ` ` `// distance from origin to center ` `// of inner circle radius of black ` `// circle in figure ` `$R` `= 7; ` ` ` `// Value of Pi ` `$pi` `= (float)3.14159; ` `$Volume` `= 0; ` `$Volume` `= 2 * ` `$pi` `* ` `$pi` `* ` `$R` `* ` `$r` `* ` `$r` `; ` ` ` `echo` `"Volume: "` `, ` `$Volume` `, ` `"\n"` `; ` ` ` `$Surface` `= 4 * ` `$pi` `* ` `$pi` `* ` `$R` `* ` `$r` `; ` ` ` `echo` `"Surface: "` `, ` `$Surface` `, ` `"\n"` `; ` ` ` `// This code is contributed by ajit ` `?> ` |

*chevron_right*

*filter_none*

**Output:**

Volume: 1243.568195 Surface: 829.045464

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.

## Recommended Posts:

- Calculate Volume, Curved Surface Area and Total Surface Area Of Cylinder
- Calculate volume and surface area of a cone
- Calculate Volume and Surface area Of Sphere
- Program to calculate Volume and Surface area of Hemisphere
- Surface Area and Volume of Hexagonal Prism
- Program for Volume and Surface Area of Cube
- Program for Volume and Surface Area of Cuboid
- Program for Volume and Surface area of Frustum of Cone
- Program to find Surface Area and Volume of Octagonal Prism
- Program to find volume and surface area of pentagonal prism
- Program to calculate the Surface Area of a Triangular Prism
- Program to calculate area and volume of a Tetrahedron
- Program for Surface Area of Octahedron
- Find the Surface area of a 3D figure
- Program for Surface area of Dodecahedron
- Calculate Volume of Dodecahedron
- Mathematics | Area of the surface of solid of revolution
- Program to calculate volume of Ellipsoid
- Program to calculate volume of Octahedron
- Program to find the surface area of the square pyramid

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.