C Program to Find Volume and Surface Area of a Cone

C Program to Find Volume and Surface Area of a Cone

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

Programs to Find Volume and Surface Area of a Cone in C

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

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

/* C Program to find Volume and Surface Area of a Cone */
#include <stdio.h>
#include <math.h>

int main()
{
  float radius, height;
  float Volume, SA, l, LSA;
  
  printf("\n Please Enter Radius of a Cone :- ");
  scanf("%f", &radius);
  
  printf("\n Please Enter Height of a Cone :- ");
  scanf("%f", &height);

  l = sqrt(radius * radius + height * height);
  SA = M_PI * radius * (radius + l);
  Volume = (1.0/3) * M_PI * radius * radius * height;
  LSA = M_PI * radius * l;

  printf("\n Length of a Side (Slant)of a Cone = %.2f", l);    
  printf("\n Surface Area of a Cone = %.2f", SA);
  printf("\n Volume of a Cone = %.2f", Volume);
  printf("\n Lateral Surface Area of a Cone = %.2f", LSA);

  return 0;
}

The output of the above c program; as follows:

Please Enter Radius of a Cone :- 10
Please Enter Height of a Cone :- 6
Length of a Side (Slant)of a Cone = 11.66
 Surface Area of a Cone = 680.53
 Volume of a Cone = 628.32
 Lateral Surface Area of a Cone = 366.37

C Program to Find Volume and Surface Area of a Cone using Function

/* C Program to find Volume and Surface Area of a Cone */
#include <stdio.h>
#include <math.h>

float VolSurCONE(float radius,float height)
{
  float Volume, SA, l, LSA;
  l = sqrt(radius * radius + height * height);
  SA = M_PI * radius * (radius + l);
  Volume = (1.0/3) * M_PI * radius * radius * height;
  LSA = M_PI * radius * l;

  printf("\n Length of a Side (Slant)of a Cone = %.2f", l);    
  printf("\n Surface Area of a Cone = %.2f", SA);
  printf("\n Volume of a Cone = %.2f", Volume);
  printf("\n Lateral Surface Area of a Cone = %.2f", LSA);
}
int main()
{
  float radius, height;

  
  printf("\n Please Enter Radius of a Cone :- ");
  scanf("%f", &radius);
  
  printf("\n Please Enter Height of a Cone :- ");
  scanf("%f", &height);

  VolSurCONE(radius,height);

  return 0;
}

The output of the above c program; as follows:

Please Enter Radius of a Cone :- 5
Please Enter Height of a Cone :- 5
Length of a Side (Slant)of a Cone = 7.07
 Surface Area of a Cone = 189.61
 Volume of a Cone = 130.90
 Lateral Surface Area of a Cone = 111.07

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 *