0% found this document useful (0 votes)
5 views2 pages

Que 4

The document provides a C# console program that calculates the surface area of a sphere using a function. It prompts the user to input the radius, computes the area using the formula 4 * π * radius^2, and displays the result. The program is structured within a namespace and includes necessary using directives for functionality.

Uploaded by

Swarup Atigre
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Que 4

The document provides a C# console program that calculates the surface area of a sphere using a function. It prompts the user to input the radius, computes the area using the formula 4 * π * radius^2, and displays the result. The program is structured within a namespace and includes necessary using directives for functionality.

Uploaded by

Swarup Atigre
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Practical Number :

04 Roll No :
1615

Que 4) Write a console program to calculate area of sphere by using


function. using System.

using [Link];
using [Link];
using [Link];
using [Link];
namespace Journal
{
class practical
{
//Function to calculate the area of a sphere
static double SphereArea(double radius)
{
return 4 * 3.1416 * radius * radius;
}
static void Main()
{
[Link]("Enter the radius of the sphere:");
double radius = [Link]([Link]());
double area = SphereArea(radius);
[Link]("Surface area of the sphere is:" + area);
[Link]();
}
}
}
Output of the Code:

You might also like