Here you go. My changes are in bold.
Code:
#include <stdio.h>
#define PI 3.14159
int main(void)
{
int c, r, shape;
float a;
printf("What is the total 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);
printf("%d\n", 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=( c / 4 ); /*Math error. If the user entered the total length then it should be : c/4. */
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;
}
Also removed the ; after the if statments.