int main(void) { int qty; //Quantity of washer double weight, //Weight of each washer, to get from other parameters volume, //Volume, to get from rim area and thickness density, //density of material (either a constant or a input d1, //inner diameter (raw input) d2, //outer diameter (raw input) area, //area to get from diameters thickness; //thickness of a drum (raw input) printf("Please input inner diameter and input outer diameter in centimeter in following format: [inner diameter],[outer diameter]\n"); scanf("%lf,%lf" , &d1, &d2); //printf("%lf and %lf", d1, d2); printf("Please input thickness of the drum in centimeters.\n"); scanf("%lf", &thickness); printf("Please input density of the material in g/cm^3.\n"); scanf("%lf", &density); printf("Please input quantity of the washer.\n"); scanf("%d", &qty); area = circle_area(d2)-circle_area(d1); volume = area * thickness; weight = volume * density; printf("the weight of %d washers is %lf g.", qty, qty * weight); return 0; }
void do_circle(void) { double radius, area; printf("Please enter the radius of the circle: "); scanf("%lf", &radius); area = circle_area(radius); printf("The area of a circle with radius %.2lf is %.2lf\n", radius, area); }//do_circle
int main(){ double length,area,volume,r,h; printf("input circle radius\n"); scanf("%lf", &r); length = circle_length(r); printf("length: %.2f\n",length); area = circle_area(r); printf("circle_area: %.2f\n",area); area = sphere_area(r); printf("sphere_area: %.2f\n", area); volume = sphere_volume(r); printf("sphere_volume: %.2f\n", volume); printf("input height\n"); scanf("%lf", &h); volume = circle_column_volume(r,h); printf("circle_column_volume: %.2f\n",volume); }
double circle_column_volume(double r, double h){ return circle_area(r) * h; }