Вопрос задан 07.12.2023 в 04:19. Предмет Информатика. Спрашивает Гусева Лиза.

(PASCAL)Напишите программу для решения следующей задачи. Ученики 4 класса вели дневники наблюдения

за погодой и ежедневно записывали дневную температуру. Найдите самую низкую температуру за время наблюдения. Если температура опускалась ниже –15 градусов, выведите YES, иначе выведите NO. Программа получает на вход количество дней, в течение которых проводилось измерение температуры N (1 ≤ N ≤ 31), затем для каждого дня вводится температура. Пример работы программы:Входные данные4–512–28Выходные данные–5NO
0 0
Перейти к ответам

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

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

Ответ:

var x:integer;

n: array[1..31] of integer;

begin

 for var i:=1 to 31 do

 begin

   write('Введите температуру ',i,' дня: '); readln(n[i]);

   if n[i]<x then x:=n[i];

 end;

 writeln; writeln('Минимальная тепература: ',x);

 if x<-15 then writeln('YES') else writeln('NO');

end.

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

Pascal Program for Finding Lowest Temperature

To solve the given problem in Pascal, we can write a program that takes the input of the number of days and the daily temperatures, then finds the lowest temperature and determines if it dropped below -15 degrees. Below is the Pascal program for the given task:

```pascal program LowestTemperature;

var N, temperature, lowestTemperature: integer; i: integer; belowMinus15: boolean;

begin lowestTemperature := 100; // Initializing with a high value to ensure any temperature will be lower belowMinus15 := false; // Initializing the flag for temperatures below -15

write('Enter the number of days: '); readln(N);

for i := 1 to N do begin write('Enter the temperature for day ', i, ': '); readln(temperature);

if temperature < lowestTemperature then lowestTemperature := temperature;

if temperature < -15 then belowMinus15 := true; end;

writeln('The lowest temperature observed is: ', lowestTemperature); if belowMinus15 then writeln('YES') else writeln('NO'); end. ```

This program first initializes variables for the number of days, temperatures, lowest temperature, and a flag for temperatures below -15. It then takes input for the number of days and daily temperatures, finding the lowest temperature and determining if it dropped below -15 degrees. Finally, it outputs the lowest temperature and whether it dropped below -15 degrees.

Example Output

For the given example input: ``` 4 -5 12 -28 ``` The output will be: ``` The lowest temperature observed is: -28 YES ``` This indicates that the lowest temperature observed is -28, and it dropped below -15 degrees.

0 0

Похожие вопросы

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

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

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