C Program to Calculate Volume and Total Surface Area of Sphere

  • Write a C program to find volume of a sphere.
  • Write a C program to find total surface area 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.

C Program to find total surface area of a sphere

/*
* C Program to calculate total surface area 
* of Sphere
*/
#include <stdio.h>
#include <math.h>
#include <conio.h>
 
#define PI 3.141
 
int main(){
    float radius, surfaceArea;
    printf("Enter radius of Sphere\n");
    scanf("%f", &radius);
    /* Surface area of Sphere = 
       4 X PI X Radius X Radius  */
    surfaceArea = 4*PI*radius*radius;
    printf("Total surface area of Sphere : %0.4f\n",
        surfaceArea);
     
    getch();
    return 0;
}

Program 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.

C Program to Calculate Volume and Total Surface Area of Sphere

/*
* C Program to calculate volume of Sphere
*/
#include <stdio.h>
#include <math.h>
#include <conio.h>
 
#define PI 3.141
 
int main(){
    float radius, volume;
    printf("Enter radius of Sphere\n");
    scanf("%f", &radius);
    /* Volume of Sphere = 
       4/3 X PI X Radius X Radius X Radius */
    volume = (4.0/3)*PI*radius*radius*radius;
 
    printf("Volume of Sphere : %0.4f\n", volume);
     
    getch();
    return 0;
}

Program 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.