C Program to Find Volume and Surface Area of a Cylinder

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

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 *