Вопрос задан 26.04.2021 в 01:14. Предмет Информатика. Спрашивает Кошкин Михаил.

Elaboreaza un program in Turbo PAscal care sa calculeze aria si perimetrul unui triunghi

0 0
Перейти к ответам

Ответы на вопрос

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Корсакова Варвара.

Turbo Pascal разрабатывает программу для вычисления площади и периметра треугольника

0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Sure, here's a program in Turbo Pascal that calculates the area and perimeter of a triangle:

scss
program TriangleAreaPerimeter; var side1, side2, side3, perimeter, area, s: real; begin writeln('Enter the length of side 1: '); readln(side1); writeln('Enter the length of side 2: '); readln(side2); writeln('Enter the length of side 3: '); readln(side3); perimeter := side1 + side2 + side3; s := perimeter / 2; area := sqrt(s * (s - side1) * (s - side2) * (s - side3)); writeln('Perimeter of the triangle is: ', perimeter:0:2); writeln('Area of the triangle is: ', area:0:2); readln; end.

In this program, we first ask the user to enter the lengths of the three sides of the triangle. Then, we calculate the perimeter using the formula perimeter = side1 + side2 + side3. We also calculate the semi-perimeter, s = perimeter / 2, which is used in the formula for calculating the area of the triangle. Finally, we calculate the area of the triangle using the formula area = sqrt(s * (s - side1) * (s - side2) * (s - side3)).

We then display the values of the perimeter and area to the user using the writeln function. The :0:2 syntax is used to format the output to display two decimal places.

I hope this helps!

0 0

Топ вопросов за вчера в категории Информатика

Последние заданные вопросы в категории Информатика

Задать вопрос