Задача 7 Урок 9

Задача 7 Урок 9


Пользователь вводит четыре числа, найдите из них максимальное.

var
  a,b,c,d,max:integer;
begin
  writeln('Vvedite a,b,c,d: ');
  readln(a,b,c,d);
  writeln();
  if (a > b) and (a > c) and (a > d) then
  max:=a;
  if (b > a) and (b > c) and (b > d) then
  max:=b;
  if (c > a) and (c > b) and (c > d) then
  max:=c
  else
  max:=d;
  writeln(max);
  readln();
end. 
vedro-compota's picture

решите через вложенные if

_____________
матфак вгу и остальная классика =)

Исправлено

var
  a,b,c,d,max:integer;
begin
  writeln('Vvedite a,b,c,d: ');
  readln(a,b,c,d);
  writeln();
   if (a > b) and (a > c) and (a > d) then
    max:=a
   else
    if (b > a) and (b > c) and (b > d) then
     max:=b
    else
      if (c > a) and (c > b) and (c > d) then
       max:=c
      else
       max:=d;
       writeln(max);
   readln();
end.