is it really that hard just to scroll through my code and see what im talking about?
Code:
case 5:
{
printf("\nArea Of A Circle\n");
printf("\nEnter the radius: ");
scanf("%lf", &rad1);
while(rad1 <= 0)
{
printf("ERROR!! Distance must be a positive number\n\n");
printf("Enter the radius: ");
scanf("%lf", &rad1);
}
area = (rad1 * rad1) * PI;
printf("The area of a circle with a radius of %.4f is %.4f\n\n", rad1, area);
break;
}
case 6:
{
printf("\nArea Of An Ellipse");
printf("\nEnter radius-1: ");
scanf("%lf", &rad1);
while(rad1 <= 0)
{
printf("ERROR!! Distance must be a positive number\n\n");
printf("Enter radius-1: ");
scanf("%lf", &rad1);
}
printf("\nEnter radius-2: ");
scanf("%lf", &rad2);
while(rad2 <= 0)
{
printf("ERROR!! Distance must be a positive number\n\n");
printf("Enter radius-2: ");
scanf("%lf", &rad2);
}
area = (rad1 * rad2) * PI;
printf("The area of an ellipse with a radius-1 of %.4f and a radius-2 of %.4f is %.4f", rad1, rad2, area);
break;
}
is the only place i use my pre defined PI, but when i add volumes i will use it more. again, this isn't necessarily a problem though as my code works fine without using the M_PI command