C Program to Find Volume and Surface Area of a Cylinder

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

Programs to Find Volume and Surface Area of Cylinder in C

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

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

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

/* C Program to find Volume and Surface Area of a Cylinder */

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

int main()
{
  float radius, height;
  // L = Lateral Surface Area of a Cylinder, T = Top Surface Area
  float sa,Volume, L, T;

  printf("\n Please Enter the radius and height of a cylinder :- ");
  scanf("%f %f", &radius, &height);

  sa = 2 * M_PI * radius * (radius + height);
  Volume = M_PI * radius * radius * height;
  L = 2 * M_PI * radius * height;
  T = M_PI * radius * radius;

  printf("\n Surface Area of a cylinder = %.2f", sa);
  printf("\n Volume of a Cylinder = %.2f", Volume);
  printf("\n Lateral Surface Area of a cylinder = %.2f", L);
  printf("\n Top OR Bottom Surface Area of a cylinder = %.2f", T);

  return 0;
}

The output of the above c program; as follows:

Please Enter the radius and height of a cylinder :- 10 15
Surface Area of a cylinder = 1570.80
 Volume of a Cylinder = 4712.39
 Lateral Surface Area of a cylinder = 942.48
 Top OR Bottom Surface Area of a cylinder = 314.16

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

#include <stdio.h>

#include<math.h>

float volSur(float radius, float height)
{

  // L = Lateral Surface Area of a Cylinder, T = Top Surface Area
  float sa,Volume, L, T;

  sa = 2 * M_PI * radius * (radius + height);
  Volume = M_PI * radius * radius * height;
  L = 2 * M_PI * radius * height;
  T = M_PI * radius * radius;

  printf("\n Surface Area of a cylinder = %.2f", sa);
  printf("\n Volume of a Cylinder = %.2f", Volume);
  printf("\n Lateral Surface Area of a cylinder = %.2f", L);
  printf("\n Top OR Bottom Surface Area of a cylinder = %.2f", T);
}


int main()
{

  float radius, height;

  printf("\n Please Enter the radius and height of a cylinder :- ");
  scanf("%f %f", &radius, &height);

  volSur(radius, height);

  return 0;
}

The output of the above c program; as follows:

Please Enter the radius and height of a cylinder :- 10 15
Surface Area of a cylinder = 1570.80
 Volume of a Cylinder = 4712.39
 Lateral Surface Area of a cylinder = 942.48
 Top OR Bottom Surface Area of a cylinder = 314.16

Recommended C Programs

AuthorDevendra Dode

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 *