1. Программа для подсчета периметра и площади трапеции на Pascal:
program TrapezoidAreaPerimeter;
var
a, b, c, d, h, area, perimeter: real;
begin
writeln('Enter the lengths of the bases and the height of the trapezoid:');
readln(a, b, h);
writeln('Enter the lengths of the lateral sides:');
readln(c, d);
perimeter := a + b + c + d;
area := ((a + b) / 2) * h;
writeln('Perimeter of the trapezoid: ', perimeter:0:2);
writeln('Area of the trapezoid: ', area:0:2);
end.
2. Программа для нахождения корней квадратного уравнения на Pascal:
program QuadraticEquationRoots;
var
a, b, c, discriminant, x1, x2: real;
begin
writeln('Enter the coefficients of the quadratic equation (a, b, c):');
readln(a, b, c);
discriminant := b * b - 4 * a * c;
if discriminant > 0 then
begin
x1 := (-b + sqrt(discriminant)) / (2 * a);
x2 := (-b - sqrt(discriminant)) / (2 * a);
writeln('The roots of the equation are: x1 = ', x1:0:2, ' and x2 = ', x2:0:2);
end
else if discriminant = 0 then
begin
x1 := -b / (2 * a);
writeln('The equation has a repeated root: x = ', x1:0:2);
end
else
begin
writeln('The equation has complex roots.');
end;
end.
3. Программа для вычисления факториала числа на Pascal:
program FactorialCalculation;
var
num, fact, i: integer;
begin
writeln('Enter a positive integer to calculate its factorial:');
readln(num);
fact := 1;
for i := 1 to num do
begin
fact := fact * i;
end;
writeln('Factorial of ', num, ' is: ', fact);
end.
Эти программы способны выполнять задачи, описанные в вопросе, путем ввода данных с клавиатуры и вывода результатов вычислений. Пожалуйста, убедитесь, что ваши коэффициенты и другие значения вводятся корректно для получения правильных ответов.