C Program to Find Surface Area of Sphere

In this post, we will learn how to find the surface area of a sphere using C Programming language.

Surface area of a sphere is defined as the total area covered by its outer surface. A sphere has a surface area equal to 4πr2 square units.

  • Surface area of sphere = 4πr2

We will be using the above formula in our program to find the surface area of a sphere.

So, without further ado, let’s begin this tutorial.

C Program to Find Surface Area of Sphere

// C Program to Find Surface Area of Sphere
#include <stdio.h>
int main(){
    float radius, area;
    float PI = 3.14;
    
    // Asking for input
    printf("Enter the radius of the sphere: ");
    scanf("%f", &radius);
    
    // Calculating Surface Area
    area = 4 * PI * radius * radius;
    
    // Display output
    printf("Surface Area of Sphere: %.2f", area);
    return 0;
}

Output

Enter the radius of the sphere: 3
Surface Area of Sphere: 113.04

How Does This Program Work ?

    float radius, area;
    float PI = 3.14;

In this program, we have declared three float data type variables named radius, area and PI.

    // Asking for input
    printf("Enter the radius of the sphere: ");
    scanf("%f", &radius);

Then, the user is asked to enter the radius of the sphere.

    // Calculating Surface Area
    area = 4 * PI * radius * radius;

We calculate the surface area of the sphere by using the formula 4πr2.

    // Display output
    printf("Surface Area of Sphere: %.2f", area);

Finally, the surface area is displayed on the screen using printf() function.

Conclusion

I hope after going through this post, you understand how to find the surface area of a sphere using C Programming language.

If you have any doubt regarding the program, feel free to contact us in the comment section. We will be delighted to help you.

Also Read:

Leave a Comment

Your email address will not be published. Required fields are marked *