C Program to Calculate Volume and Total Surface Area of Sphere

Here is a C program to find total surface area and volume of a sphere. A sphere is a three dimensional object such that all points on sphere are located at a distance R (radius of sphere) from a given point (center of sphere). A sphere is perfectly symmetrical and has no edges or vertices. Spheres are very common in everyday life, like soccer ball, ball bearings etc. Spheres are very common in nature, whenever an object wants to reduce it's surface area as much as possible without reducing volume, like water drops.

Total Surface Area of Sphere
Surface area of sphere is the number of square units that will exactly cover the outer surface of sphere. There is only one curved surface in sphere, no edges and corners. A sphere is perfectly symmetrical from any direction. Total surface area of a sphere is measured in square units like cm2, m2 etc.
  • Total Surface Area of Sphere = 4ΠR2
Where, R is the radius of sphere.
The total surface area of sphere is four times the area of a circle of same radius.
Archimedes first derived this formula 2000 years ago.
Volume of Sphere
The volume of sphere is defined as the amount of three dimensional space occupied by the sphere. Finding volume of a sphere help us to solve many real life problems like, how much water can be filled in a hollow spherical can. To calculate the volume of a sphere, we need radius of sphere. Volume of sphere is measured in cubic units like m3, cm3 etc.
  • Volume of Sphere = 4/3 x PI x R3
Where, R is the radius of sphere.

C Program to find total surface area of a sphere

To calculate the total surface area of sphere we need radius of sphere. Below program takes radius of sphere as input from user using scanf function and stores it in a floating point variable. Then it calculates the surface area of sphere using the formula given above. Finally, it prints the total surface area of sphere on screen using printf function.

#include <stdio.h>
#include <math.h>

#define PI 3.141

int main(){
    float radius, surfaceArea;
    
    printf("Enter radius of Sphere\n");
    scanf("%f", &radius);

    surfaceArea = 4*PI*radius*radius;
    printf("Total surface area of Sphere :
        %0.4f\n", surfaceArea);
    
    return 0;
}

Output
Enter radius of Sphere
7
Total surface area of Sphere : 615.6360
Volume of Sphere : 1436.4840

C Program to find volume of a sphere

To calculate the volume of sphere we need it's radius. Below program takes radius of sphere as input from user using scanf and stores it in a floating point variable 'radius'. Then it calculates the volume of sphere using the formula given above. Then, it prints the volume of sphere on screen using printf.

#include <stdio.h>
#include <math.h>

#define PI 3.141

int main(){
    float radius, volume;
    
    printf("Enter radius of Sphere\n");
    scanf("%f", &radius);

    volume = (4.0/3)*PI*radius*radius*radius;

    printf("Volume of Sphere : %0.4f\n", volume);
    
    return 0;
}

Output
Enter radius of Sphere
7
Total surface area of Sphere : 615.6360
Volume of Sphere : 1436.4840

Properties of Sphere
  • The distance of all points on the surface of sphere and center of sphere is same, which is equal to radius of sphere.
  • A sphere has the smallest surface area for a volume, than any other shape.
  • A tangent at any point on sphere is perpendicular to the line joining that point and center of sphere.
  • The sphere does not have a surface of centers.

Related Topics
C program to calculate volume and total surface area of cuboid
C program to calculate volume and total surface area of cone
C program to calculate volume and total surface area of cylinder
C program to calculate area of a square
C program to calculate area of a right angled triangle
C program to calculate area of an equilateral triangle
C program to remove vowels from a string
C Program to find frequency of characters in a string
List of all C Programs