c circle area code example
Example: c circle area
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#define P 3.1415926535
int main() {
int a, c;
double b;
printf("AREA OF A CIRCLE\n\n\n1: Direct formula\n2: Invers formula\n\nChose: ");
scanf("%d", &c);
switch (c)
{
case 1:
printf("\nEnter radius value: ");
scanf("%d", &a);
b = a * a * P;
printf("\nArea: %f\n\n", b);
break;
case 2:
printf("\nEnter area value: ");
scanf("%d", &a);
b = sqrt(a / P);
printf("\nRadius: %f\n\n", b);
break;
}
if(c != 1 && c != 2)
{
printf("The value is not accepted\n\n");
}
system("pause");
}