Ok... I've never programmed in C before, but my friend is taking a C course and I'm pretty good with computers and stuff and I learn pretty fast, so he asked me to help him. I got his assignment and his textbook and set out to learn C (or at least enough to do this basic assignment). He's supposed to make a program that computes the area of 5 different shapes. So here's what I've got so far...

The first error message I get when I try to compile and link it is "syntax error before 'printf' " on the lineCode:/*This program will compute the area of a rectangle, */ /*triangle, circle, ellipse, and sphere. */ #include <stdio.h> #include <math.h> #define PI 3.141593 int main(void) { /* Declare first variable. */ char shape /* Determine which shape to find the area of */ printf("Find the area of a rectangle, triangle, circle, ellipse, or sphere?"); scanf("%c",&shape); if (shape = rectangle) /* Declare set of variables for this shape */ float lengthRect, widthRect, areaRect; printf("Enter the length. \n"); scanf("%lf",&lengthRect); printf("Enter the width. \n"); scanf("%lf",&widthRect); /* Compute the area */ areaRect = lengthRect*widthRect printf("The area of the rectangle is " "%5.2lf \n",areaRect); else { if (shape = triangle) /* Declare set of variables for this shape */ float baseTri, heightTri, areaTri; printf("Enter the base. \n"); scanf("%lf",&baseTri); printf(Enter the height. \n"); scanf("%lf",&heightTri); /* Compute the area */ areaTri = .5(baseTri*heightTri) printf("The area of the triangle is " "%5.2lf \n",areaTri); else { if (shape = circle) /* Declare set of variables for this shape */ float radiusCirc, areaCirc; printf("Enter the radius. \n"); scanf("%lf",&radiusCirc); /* Compute the area */ areaCirc = PI*(radiusCirc*radiusCirc) printf("The area of the circle is " "%5.2lf \n",areaCirc); else { if (shape = ellipse) /* Declare set of variables for this shape */ float semiaxisA, semiaxisB, areaEllipse; printf("Enter the length of semiaxisA. \n"); scanf("%lf",&semisacisA); printf(Enter the length of semiaxisB. \n"); scanf("%lf",&semiaxisB); /* Compute the area */ areaEllipse = PI*semiaxisA*semiaxisB printf("The area of the ellipse is " "%5.2lf \n",areaEllipse); else { if (shape = sphere) /* Declare set of variables for this shape */ float radiusSphere, areaSphere; printf(Enter the length of the radius. \n"); scanf("%lf",&radiusSphere); /* Compute the area */ areaSphere = 4*PI*radiusSphere*radiusSphere printf("The surface area of the sphere is " "%5.2lf \n",areaSphere); } } } } return 0; }

Why would it be telling me this? I can't figure it out. But I guess yo knew that or I wouldn't be posting here. Thanks for the help.Code:printf("Find the area of a rectangle, triangle, circle, ellipse, or sphere?");