UPDATE: I am ALMOST THERE!
When I input(in bold), I don't get the same answer as 2.670 kg. I get 18.096 kg instead.
Inner diameter in cm: 1.2
Outer diameter in cm: 2.4
Thickness in cm: 0.1
Material density in g/cm^3: 7.87
Quantity in batch: 1000
The expected weight of the washer batch is 2.670 kg.
Code:
/* homework 6 */
/* Directives */
#include <stdio.h>
#define PI 3.14159
int main(void)
{
float inner, diameter, thickness, density, weight;
int quantity;
printf("Welcome to the Washer Weight Batch Program.\n");
printf("Please enter the following washer information.\n");
printf("Inner diameter in cm: ");
scanf("%e", &inner);
printf("Outer diameter in cm: ");
scanf("%E", &diameter);
printf("Thickness in cm: ");
scanf("%f", &thickness);
weight = PI * pow(diameter,2) - PI * pow(inner,2) * thickness * density;
printf("Material density in g/cm^3: ");
scanf("%f", &density);
printf("Quantity in batch: ");
scanf("%i", &quantity);
printf("The expected weight of the washer batch is: %.3f kg.\n", weight);
/* End Program */
return(0);
}