C Program to Find Volume and Surface Area of Sphere

In this tutorial, i am going to show you how to find or calculate volume and surface area of sphere with the help of standard formula and function in c programs.

All C Programs to Find Volume and Surface Area of Sphere in C

  • C Program to Find Volume and Surface Area of Sphere using Standard Formula
  • C Program to Find Volume and Surface Area of Sphere using Function

C Program to Find Volume and Surface Area of Sphere using Standard Formula

/* C Program to find Volume and Surface Area of Sphere */
#include <stdio.h>
#define PI 3.14
int main()
{
  float radius, sa,Volume;
  printf("\n Please Enter the radius of a Sphere :-");
  scanf("%f", &radius);
  sa =  4 * PI * radius * radius;
  Volume = (4.0 / 3) * PI * radius * radius * radius;
  printf("\n The Surface area of a Sphere = %.2f", sa);
  printf("\n The Volume of a Sphere = %.2f", Volume);
  return 0;
}

The result of the above c program; as follows:

Please Enter the radius of a Sphere :-10
The Surface area of a Sphere = 1256.00
 The Volume of a Sphere = 4186.67

C Program to Find Volume and Surface Area of Sphere using Function

#include <stdio.h>
#define PI 3.14
float volSur(float r)
{
   float sa,Volume;
   sa =  4 * PI * r * r;
   Volume = (4.0 / 3) * PI * r * r * r;
   printf("\n The Surface area of a Sphere = %.2f", sa);
   printf("\n The Volume of a Sphere = %.2f", Volume);
}
int main()
{
  float r;
  printf("\n Please Enter the radius of a Sphere :-");
  scanf("%f", &r);
  volSur(r); 
  return 0;
}

The result of the above c program; as follows:

Please Enter the radius of a Sphere :-10
The Surface area of a Sphere = 1256.00
The Volume of a Sphere = 4186.67

More C Programming Tutorials

Leave a Comment