Help on my C programming (noob)
This is the goal:
Prompt the user for the inner and outer diameter and thickness of the washer to be entered in cm. Then prompt for the material density in grams per cubic cm (g/cm^3) and the number of washers in the batch. Finally, print out the expected weight in kg. Make sure that 3 digits after the decimal are always displayed for your results.
When executed, it should say:
Welcome to the Washer Weight Batch Program.
Please enter the following washer information.
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.
--------------------------------------------------------------------------------------------------------------
Alright. So this is what I have so far. Please let me know what I need to change or add on.
Code:
/* Directives */
#include <stdio.h>
#define PI 3.14159
int main(void)
{
float inner, diameter, thickness, density; NOT SURE ON THESE FLOAT VARIABLES
printf("Welcome to the Washer Weight Batch Program.\n");
printf("Please enter the following washer information.\n");
printf("Inner diameter in cm: ");
scanf("%f", &inner); NOT TOO SURE ON THESE EITHER.
printf("Outer diameter in cm: ");
scanf("%f", &diameter);
printf("Thickness in cm: ");
scanf("%f", &thickness);
printf("Material density in g/cm^3: ");
scanf("%f", &density);
printf("Quantity in batch: ");
printf("The expected weight of the washer batch is: %.3f kg.\n");
/* End Program */
return(0);
}
It's using the correct equations to make the program calculate the expected weight of the washer batch that is getting me stuck. I'm not 100% sure on computing that.