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

My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of Tutsmake.com. I like writing tutorials and tips that can help other developers. I share tutorials of 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 from a starting stage. As well as demo example.

Leave a Reply

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