Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that asks the user to input the height and radius of a cone (bot

ID: 3847551 • Letter: W

Question

Write a program that asks the user to input the height and radius of a cone (both of type double) and calls 4 individual functions to calculate the base area of the cone, the surface area of the cone (Conic Area), the total area of the cone, and the volume of the cone. The main function then prints these values with appropriate messages. Given parameters b and h which stand for the base and the height of an isosceles triangle (i.e., a triangle that has two equal sides), write a C program that calculates: The area of the triangle; The perimeter of the triangle; and The volume of the cone formed by spinning the triangle around the line h The program must prompt the user to enter band h (both of type double). The program must define and use the following three functions: CalcArea (base, height)//calculates and returns the area of the triangle CalcPerimeter (base, height)//calculates and returns the perimeter CalcVolume(base, height)//calculates and returns the volume Format the results so that only three digits after the decimal point are displayed.

Explanation / Answer

//program to calculate various types of areas and volume of cone in language c.
#include<stdio.h>
#include<math.h>
float pi=M_PI;//accesing value of irrational number pi
float base_area_of_cone(float height,float radius);// function for calculating base area
float surface_area_of_cone(float height,float base);
float total_area_of_cone(float height,float radius);
float volume_of_cone(float height,float radius);

void main()
{

double height,radius;//variables to contain values of height and radius of cone respectively
printf("Enter values of height and radius respectively ");//printing message for user
scanf("%lf%lf",&height,&radius);//scaning values of height and radius of cone respectively


printf("The base area of cone is %f ",base_area_of_cone(height,radius));//printing calculated values
printf("The surface area of cone is %f ",surface_area_of_cone(height,radius));
printf("The total area of cone is %f ",total_area_of_cone(height,radius));
printf("The volume of cone is %f ",volume_of_cone(height,radius));


}
//writing functions to calculate various areas and volume
float base_area_of_cone(float height,float radius){

//formula pi*radius*radius
return pi*pow(radius,2);

}

//conic area
float surface_area_of_cone(float height,float radius){

//formula pi *radius*slant height of cone

float l=sqrt((height*height)+(radius*radius));
return pi*radius*l;

}

float total_area_of_cone(float height,float radius){

//formula pi*radius*radius +pi*radius*slant height of cone
return surface_area_of_cone(height,radius)+base_area_of_cone(height,radius);
}
float volume_of_cone(float height,float radius){

//formula 1/3*pi*radius*radius*height
return (pi*pow(radius,2)*height)/3;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote