Составьте программу для вычисления площади геометрических фигур (PASCAL abc)

15 Фев 2020 в 19:41
129 +1
0
Ответы
1

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.

18 Апр 2024 в 17:17
Не можешь разобраться в этой теме?
Обратись за помощью к экспертам
Гарантированные бесплатные доработки в течение 1 года
Быстрое выполнение от 2 часов
Проверка работы на плагиат
Поможем написать учебную работу
Прямой эфир