C Program For Surface Area And Volume of Cylinder

Find surface area and volume of cylinder in C: The formula to find surface area of cylinder is A = 2πrh+2πr2 and to find volume of cylinder is V = πr2h.

C Program to find surface area and volume of a cylinder:

/* Aim: Accept dimensions for a cylinder and print the surface area and volume */

#include<stdio.h>

int main()
{
	int r,h;
	float s,v;

	printf("\n Enter Your Radius: ");
	scanf("%d",&r);

	printf("\n Enter Your Height: ");
	scanf("%d",&h);

	s=(2*3.14*r*r)+(2*3.14*r*h);
	v=3.14*r*r*h;

	printf("\n The Surface Area of Cylinder is %f",s);
	printf("\n \n The Volume of Cylinder is %f \n \n",v);

	return 0;
}

/* Output of above code -

 Enter Your Radius: 1

 Enter Your Height: 1

 The Surface Area of Cylinder is 12.560000
 
 The Volume of Cylinder is 3.140000 */