C Program to Find Volume and Surface Area of a Cylinder

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

All C Programs to Find Volume and Surface Area of Cylinder

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

More C Programming Tutorials

Leave a Comment