C Program to Find Volume and Surface Area of Sphere

C Program to Find Volume and Surface Area of Sphere

C program to find volume and surface area of sphere; Through this tutorial, we will learn how to find or calculate volume and surface area of sphere using standard formula and function in c programs.

Programs to Find Volume and Surface Area of Sphere in C

To find or calculate volume and surface area of sphere using standard formula and function in c programs:

  • 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 output 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 output 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

Recommended C Programs

AuthorAdmin

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

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