Вопрос задан 25.07.2018 в 19:53. Предмет Информатика. Спрашивает Меркулова Мария.

Составить программу, которая будет вводить N чисел и искать максимальное число среди этих чисел.

1<=a[i], N<=100
0 0
Перейти к ответам

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Старков Егор.
Const
n=100;
var
a:array[1..n] of integer;
max,i:integer;
begin
randomize;
for i:=1 to n do
begin
writeln(a[i]='');
readln(a[i]);
end;
max:=a[1];
for i:=2 to n do
If a[i]>max then begin
max:=a[i];
end;
writeln;
writeln('Max=',max);
readln;
End.
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Program to Find the Maximum Number Among N Numbers

To create a program that inputs N numbers and finds the maximum number among them, you can use the following Python code:

```python # Input the value of N N = int(input("Enter the value of N: "))

# Initialize max_num as the smallest possible value max_num = -float('inf')

# Input N numbers and find the maximum for i in range(N): num = float(input(f"Enter number {i+1}: ")) if num > max_num: max_num = num

# Print the maximum number print(f"The maximum number among the {N} numbers is: {max_num}") ```

This program first takes the value of N as input. Then, it initializes `max_num` as the smallest possible value and iterates through the N numbers, updating `max_num` if a larger number is found. Finally, it prints the maximum number among the N numbers.

Note: This code is written in Python and assumes that the input numbers are floating-point numbers. If you need the program in a different programming language or for a specific type of numbers, please let me know.

Would you like to discuss anything else?

0 0

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

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

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