
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to find Volume and Surface Area of a Sphere using C#?
For volume and surface area of a sphere, firstly declare a variable with the value of radius.
int r = 15;
Get the volume f the sphere.
// calculating volume of sphere cal_volume = (4.0 / 3) * (22 / 7) * r * r * r;
Now the surface area of the sphere is calculated −
cal_area = 4 * (22 / 7) * r * r;
Let us see the complete code −
Example
using System; using System.Collections.Generic; public class Demo { public static void Main(string[] args) { double cal_area, cal_volume, r; // radius r = 15; // calculating area of sphere cal_area = 4 * (22 / 7) * r * r; // calculating volume of sphere cal_volume = (4.0 / 3) * (22 / 7) * r * r * r; Console.WriteLine("Area of Sphere: " + cal_area); Console.WriteLine("Volume of Sphere: " + cal_volume); } }
Output
Area of Sphere: 2700 Volume of Sphere: 13500
- Related Questions & Answers
- Java Program to Find the Surface area and Volume of Cuboid
- Surface Area and Volume of Hexagonal Prism in C programming
- Program for Volume and Surface Area of Cube in C++
- Program for Volume and Surface Area of Cuboid in C++
- Program for Volume and Surface area of Frustum of Cone in C++
- How to calculate the volume of a sphere using C programming language?
- Program to find the Area and Volume of Icosahedron in C++
- Program to calculate area and volume of a Tetrahedron
- Find maximum volume of a cuboid from the given perimeter and area in C++
- Find the Surface area of a 3D figure in Python
- Program for Surface area of Dodecahedron in C++
- Program for Surface Area of Octahedron in C++
- Plotting points on the surface of a sphere in Python's Matplotlib
- Surface Area of 3D Shapes in Python
- C program to find the area of circle and cylinder using structures.
Advertisements