Написать программу нахождения наибольшего значения их пяти переменных

0 голосов
31 просмотров

Написать программу нахождения наибольшего значения их пяти переменных


Информатика (34 баллов) | 31 просмотров
Дано ответов: 2
0 голосов
Правильный ответ

Var a,b,c,d,e,max:integer;
begin 
writeln('a, b, c, d, e:');
readln(a,b,c,d,e);
If a>b then max:=a else max:=b;
If c>max then max:=c;
If d>max then max:=d;
If e>max then max:=e;
Writeln('max = ',max);
End.

Пример:
a, b, c, d, e:
8 5 2 9 4
max = 9

(194k баллов)
0 голосов

Var a,b,c,d,e,max:integer;
begin
readln(a,b,c,d,e);
If (a>b) and (a>c) and (a>d) and (a>e) then max:=a;
If (b>a) and (b>c) and (b>d) and (b>e) then max:=b;
If (c>a) and (c>b) and (c>d) and (c>e) then max:=c;
If (d>a) and (d>b) and (d>c) and (d>e) then max:=d;
If (e>a) and (e>b) and (e>c) and (e>d) then max:=e;
Writeln(max);
End.

(1.6k баллов)