Program format 1. Your program must follow this format That is to say, it must h
ID: 3028010 • Letter: P
Question
Program format 1. Your program must follow this format That is to say, it must have a title block, a program description, and a list of variables. See the illustration shown below. Also, within the program there must be proper indenting and comments relating to major sections of the program like those presented in the demo programs. DATE: mm/dd/yyyy ENGR 200.xx change xx to your section number Author DESCRIPTION This program will DESCRIPTION OF VARIABLES I TYPE I DESCRIPTION list variables data type, and descriptionExplanation / Answer
Code:
/***************************************************************
ENGR 200.xx DATE:mm/dd/yyyy
EXAM:#1 Author:
*****************************************************************
PROGRAM DESCRIPTION
This program will calculate the small radius, the large radius and
the surface area of the frustum from the height and volume entered
by the user
DESCRIPTION OF VARIABLES
NAME | TYPE| DESCRIPTION
-----------------------------------------------------------------
radius1 float small radius
radius2 float large radius
volume float volume of frustum
height float height of frustum
surface_area float surface area of frustum
******************************************************************/
#include<stdio.h>
#include<math.h>
#define PI 3.141593
int main()
{
float radius1,radius2,volume,height,surface_area; //Declare variables
float pi=PI;
printf("Enter the frustum's volume");
scanf("%f",&volume);
printf("Enter the frustum's height");
scanf("%f",&height);
radius1=sqrt((3*volume/(pi*height*3.64))); //Calculate radius 1
radius2=1.2*radius1; //Calculate radius 2
surface_area=(pi*(radius1+radius2*sqrt(pow((radius2-radius1),2)+pow(height,2)))+pi*(pow(radius1,2)+pow(radius2,2)));
printf("The small radius of the frustum is %f ", radius1);
printf("The large radius of the frustum is %f ", radius2);
printf("The surface area of the frustum is %f ", surface_area);
}
Output:
The small radius of the frustum is 1.774294
The large radius of the frustum is 2.129153
The surface area of the frustum is 196.946106
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.