Problem with area of circle program
Hi
The program itself is running fine at first, but for some reason when I enter the radius for multiplication, I keep getting the Area result as 0.
Any help would be much appreciated! ;) :)
Code:
#include <stdio.h>
#include <conio.h>
#define PI 3.141569
float process(float radius);
int main()
{
float area, radius;
int count;
printf("To STOP, enter 0 for the radius\n"); printf("Radius = ? ");
scanf("%f", &radius);
for (count = 1; radius !=0; ++count) {
if (radius < 0)
area = 0;
else
area = process(radius);
printf("Area = %f\n", area);
printf("\nRadius = ? ");
scanf("%f", &radius);
}
}
float process(float radius)
{
float a;
a = PI * r * r;
getch();
return 0;
}