40 lines
654 B
C
40 lines
654 B
C
#include <stdio.h>
|
|
#define P 3.14
|
|
|
|
int main()
|
|
{
|
|
char fig;
|
|
char dato;
|
|
float area;
|
|
float num;
|
|
scanf("%c %c%f", &fig, &dato, &num);
|
|
|
|
if (fig == 'Q')
|
|
{
|
|
if (dato == 'D')
|
|
{
|
|
area = num * num / 2;
|
|
}
|
|
else if (dato == 'L')
|
|
{
|
|
area = num * num;
|
|
}
|
|
|
|
printf("Area quadrato = %f\n", area);
|
|
}
|
|
else if (fig == 'C')
|
|
{
|
|
if (dato == 'D')
|
|
{
|
|
area = P * num * num / 4;
|
|
}
|
|
else if (dato == 'R')
|
|
{
|
|
area = P * num * num;
|
|
}
|
|
|
|
printf("Area cerchio = %f\n", area);
|
|
}
|
|
|
|
return 0;
|
|
} |