Answer to Question #243361 in C for sthe

Question #243361

Given the values for radius and height of a Cylinder, code a C program to calculate Surface Area of the Cylinder. Function CalculateArea must accept height and radius as parameters. 


1
Expert's answer
2021-09-28T01:04:48-0400
#include<stdio.h>  




float CalculateArea(float radius,float height){
	const float PI = 3.14159265359; 
	return (2 * PI * radius * height) + (2 * PI * radius * radius);
}
int main()  {  
	float radius, height, area;  
	printf("Enter radius of the cylinder: ");  
	scanf("%f", &radius);
	printf("Enter height of the cylinder: ");  
	scanf("%f", &height);
	area =CalculateArea(radius,height);  
	printf("Surface area of the cylinder is %.4f\n", area);  




	getchar();
	getchar();
	return 0;  
}  

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS