Code:
Originally Posted by
spazx
It keeps saying expression syntax.
The equation is to find the surface area for one side of the gasket. It is the difference between d_gasket and d_hole, both of which need to be squared before subtracted.
Here is the full code:
#include <stdio.h>
int main(void)
{
double d_gasket, d_hole, area;
printf("Gasket Area Program Started.");
#define PI = 3.14159265;
printf("\n Enter the diameter of the gasket.");
scanf("%lg", d_gasket);
while (d_gasket<= 0)
{
printf("\n Error: Must be greater than zero");
scanf("%lg", d_gasket);
}
printf("\n Enter the diameter of the hole.");
scanf("%lg", d_hole);
while (d_gasket*.3<= d_hole)
{
printf("\n Error: Hole too small.");
scanf("%lg", d_hole);
}
while (d_gasket*.9>= d_hole)
{
printf("\n Error: Hole too large");
scanf("%lg", d_hole);
}
area = ((PI)*(d_gasket^2)-(d_hole^2))/4;
printf("\n Area:", &area);
printf("\n Gasket diameter:", &d_gasket);
printf("\n Hole diameter:", &d_hole);
printf("\n Normal Termination");
return 0;
}
Also PI declaration is incorrect... get rid of 1) '=' and 2) the semicolon ';'