This is a C# Program to find volume and surface area of a sphere.

This C# Program finds Volume and Surface Area of a Sphere.

Here radius and height of the sphere are obtained from the user and the surface area and its volume its calculated.

Here is source code of the C# Program to find Volume and Surface Area of a Sphere. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.

/* * C# Program to find Volume and Surface Area of a Sphere */ using System; using System.IO; class program { public static void Main() { double r, surface_area, volume; double PI = 3.14; Console.WriteLine("Enter the Radius of the Sphere: "); r = Convert.ToDouble(Console.ReadLine()); surface_area = 4* PI * r * r; volume = (4.0 / 3) * PI * r * r * r; Console.WriteLine("Surface Area of Sphere is : {0} ", surface_area); Console.WriteLine("Volume of Sphere is : {0}", volume); Console.Read(); } }

In this C# program, library function defined in <math.h> header file is used. We are reading the radius of the Sphere using ‘r’ variable. To compute the area and volume of the sphere the following formula is used

Surface_area = 4 * Pi * r * r,

Volume = 4 / 3 * Pi * r * r * r

where Pi = 22/7.

Enter the Radius of Sphere : 5 Surface Area of Sphere is : 314 Volume of Sphere is : 523.333333333333333

**Sanfoundry Global Education & Learning Series – 1000 C# Programs.**

**Next Steps:**

- Get Free Certificate of Merit in C# Programming
- Participate in C# Programming Certification Contest
- Become a Top Ranker in C# Programming
- Take C# Programming Tests
- Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

**Related Posts:**

- Apply for Computer Science Internship
- Practice Computer Science MCQs
- Apply for C# Internship
- Practice MCA MCQs
- Buy MCA Books