Hello. I am working on an assignment for class, and I was wondering if I am following flow of control correctly here. I'm still a litle new to flow of control and using the if, else, and while statments.
Any help would be greatly appreciated! Thanks.
Gabe
Code:#include <stdio.h>
#define PI = 3.14159
int main(void)
{
int c, r, shape;
float a;
printf("What is the length of your fence in feet?\n");
scanf("%d", &c);
if (c >= 0.0);
printf("What shape will your enclosure be, (1)circle, or (2)square?\n");
scanf("%d", &shape);
if (shape!=1 || shape!= 2);
printf("Sorry, that is an invalid shape.\n");
else
if (shape=1);
r=( c/(2 * PI) );
a=( PI * ( r * r ) );
printf("The area of your enclosure is %.2f.\n", a);
if (shape=2);
r=( 4 * c );
a=( r * r );
printf("The area of your enclosure is %.2f.\n", a);
else
printf("Sorry. The length of the fence must be a positive integer.\n");
return 0;
}