
Помогите пожалуйста написать надо на проге Pascal напишите пропоследовательности грамму которая в
натуральных чисел определяет максимальное число оканчивающееся на 8. Программа получает на вход количество чисел в последовательности, а затем сами числа. В последовательности имеется число, которое оканчивающееся на 8. Количество чисел не превышает 1000. введённые числа не превышают 30 000. Программа должна вывести ожно число-максимальное число, оканчивающееся на 8

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

var
i,max,n:integer;
begin
max:=0;
readln(n);
for i:=1 to n do
begin
readln(n);
if (n>max) and (n mod 10 = 8) then
max:=n;
end;
writeln;
writeln(max);
end.



To write a program in Pascal that determines the maximum number ending in 8 in a sequence of natural numbers, you can follow these steps:
1. Declare the necessary variables: - `n`: an integer to store the number of elements in the sequence - `sequence`: an array of integers to store the sequence of numbers - `maxNumber`: an integer to store the maximum number ending in 8
2. Read the number of elements in the sequence from the user: - Use the `ReadLn` function to read the value into the variable `n`
3. Read the sequence of numbers from the user: - Use a loop to read `n` numbers into the `sequence` array using the `ReadLn` function
4. Initialize `maxNumber` to a value that is guaranteed to be less than any number in the sequence (e.g., 0).
5. Iterate over the sequence of numbers: - Use a loop to iterate over each number in the `sequence` array - Check if the current number ends in 8 and is greater than `maxNumber` - If it is, update `maxNumber` with the current number
6. Print the maximum number ending in 8: - Use the `WriteLn` function to output the value of `maxNumber`
Here's an example implementation of the program in Pascal


Похожие вопросы
Топ вопросов за вчера в категории Информатика
Последние заданные вопросы в категории Информатика
-
Математика
-
Литература
-
Алгебра
-
Русский язык
-
Геометрия
-
Английский язык
-
Химия
-
Физика
-
Биология
-
Другие предметы
-
История
-
Обществознание
-
Окружающий мир
-
География
-
Українська мова
-
Информатика
-
Українська література
-
Қазақ тiлi
-
Экономика
-
Музыка
-
Право
-
Беларуская мова
-
Французский язык
-
Немецкий язык
-
МХК
-
ОБЖ
-
Психология
-
Физкультура и спорт
-
Астрономия
-
Кыргыз тили
-
Оʻzbek tili