Вопрос задан 26.07.2018 в 10:13. Предмет Информатика. Спрашивает Исупова Даша.

Вводится n чисел. Найти наибольшее.(Паскаль АВС)

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

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Николаева Вика.
Program MAX;
var
    a:integer;{само проверяемое число}
    m:integer;{максимально число}
begin
m:=0;{начальное значение максимального числа}
writeln('Введите ваше число:', '(Если захотите выйти, напишите ноль)':3);
readln(a);
while (a <> 0) then begin
          If (a > m) then begin
          m:= a; end;
           readln(a); end;
writeln('Максимально число:', m:3);
End.
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Finding the Largest Number in a Sequence (Pascal)

To find the largest number in a sequence of n numbers in Pascal, you can use a simple algorithm to iterate through the numbers and keep track of the largest number encountered so far. Here's a basic example of how you can achieve this in Pascal:

```pascal program FindLargestNumber; var n, i, max, num: integer; begin write('Enter the value of n: '); readln(n); write('Enter number 1: '); readln(max); for i := 2 to n do begin write('Enter number ', i, ': '); readln(num); if num > max then max := num; end; writeln('The largest number is: ', max); end. ```

In this example, the program prompts the user to enter the value of n and then iterates through n numbers, updating the variable max whenever a larger number is encountered.

This algorithm ensures that the largest number in the sequence is identified and displayed at the end of the process.

I hope this helps! Let me know if you have further questions or need additional assistance.

0 0

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

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

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