•Name your program lab1.c •Use -> #define PI 3.14159 •Get inner diameter, outer diameter, and thickness in centimeters •Get the material density (grams/cm3) and quantity manufactured •Compute the rim area •Computer the weight of a flat washer •Computer the weight of the batch of washers •Display the weight of the batch of washers using pointers

Respuesta :

Answer:

#include <stdio.h>

#define PI 3.14159

int  main(void)

{

double inner_diameter,outer_diameter,thickness,area,density,quantity;

double inner_radius,outer_radius,unit_weight,weight;

/* Get the inner diameter, outer diameter, and thickness.*/

printf("Inner diameter in centimeters> ");

scanf("%lf", &inner_diameter);

printf("Outer diameter in centimeters> ");

scanf("%lf", &outer_diameter);

printf("Thickness in centimeters> ");

scanf("%lf", &thickness);

 

/* Get the material density and quantity manufactured. */

printf("Material density in grams per cubic centimeter> ");

scanf("%lf", &density);

printf("Quantity in batch> ");

scanf("%lf", &quantity);

/* Compute the washer area. */

inner_radius = inner_diameter / 2.0;

outer_radius = outer_diameter / 2.0;

area = PI * outer_radius * outer_radius - PI * inner_radius * inner_radius;

/* Compute the weight of a flat washer. */

unit_weight = area * thickness * density;

/* Compute the weight of the batch of washers. */

weight = unit_weight * quantity;

/* Display the weight of the batch of washers. */

printf("\nThe expected weight of the batch is %.2f grams.", weight);

return (0);

}

Explanation: