var choice: integer; radius, side1, side2, base, height: real;
begin writeln('Choose a geometric figure to calculate its area:'); writeln('1. Circle'); writeln('2. Rectangle'); writeln('3. Triangle'); readln(choice);
case choice of 1: begin writeln('Enter the radius of the circle: '); readln(radius); writeln('Area of the circle is: ', 3.14 radius radius:0:2); end; 2: begin writeln('Enter the length of the rectangle: '); readln(side1); writeln('Enter the width of the rectangle: '); readln(side2); writeln('Area of the rectangle is: ', side1 side2:0:2); end; 3: begin writeln('Enter the base of the triangle: '); readln(base); writeln('Enter the height of the triangle: '); readln(height); writeln('Area of the triangle is: ', 0.5 base * height:0:2); end; else writeln('Invalid choice'); end; end.
program CalculateArea;
var
choice: integer;
radius, side1, side2, base, height: real;
begin
writeln('Choose a geometric figure to calculate its area:');
writeln('1. Circle');
writeln('2. Rectangle');
writeln('3. Triangle');
readln(choice);
case choice of
1: begin
writeln('Enter the radius of the circle: ');
readln(radius);
writeln('Area of the circle is: ', 3.14 radius radius:0:2);
end;
2: begin
writeln('Enter the length of the rectangle: ');
readln(side1);
writeln('Enter the width of the rectangle: ');
readln(side2);
writeln('Area of the rectangle is: ', side1 side2:0:2);
end;
3: begin
writeln('Enter the base of the triangle: ');
readln(base);
writeln('Enter the height of the triangle: ');
readln(height);
writeln('Area of the triangle is: ', 0.5 base * height:0:2);
end;
else
writeln('Invalid choice');
end;
end.