Program must be written in C Write a program to calculate the volume of a corn p
ID: 3562243 • Letter: P
Question
Program must be written in C
Write a program to calculate the volume of a corn pile (right circular cone) in both cubic feet and in bushels. The user will enter the circumference of the base of the cone and the height of the cone in feet. The program should determine the radius of the base from the circumference and calculate the volume of the cone in both cubic feet and bushels. Be sure to use constants for PI and the number of cubic feet per bushel. Finally, the program should print the volume in both cubic feet % bushels for the user, with exactly 1 decimal place. Be sure to label your output appropriately.
Use the following formulas:
Circle = 2*pi*r
Right Circular Cone: V=(pi*(r^2)*h)/3
1 Bushel = 1.25 cubic feet.
Explanation / Answer
#include<stdio.h>
#include<math.h>
int main()
{
double circumference,radius,height,volume,pi=3.14;
printf("Enter circumference and height:");
scanf("%lf %lf",&circumference,&height);
radius = (circumference * 1.0 ) / (2.0 * pi );
volume = (1.0 * pi * radius * radius * height ) / 3.0;
printf("Volume in cubic feet and Bushel:");
printf("%.1lf %.1lf ",volume , (volume *1.0)/(1.25));
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.