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

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

У вас есть три числа (три переменные) найдите их медиану.

var a,b,c: integer;
begin
   writeln('vvedite chisla a, b, c');
   readln(a,b,c);
   if a>b then
     if b>c then
        writeln(b)
     else if c>a then
        writeln (c)
          else
            writeln(a)
   else if b<c then
       writeln(b)
     else if c<a then
       writeln(c)
         else
            writeln(a);
   readln();
end.    
vedro-compota's picture

проверить форматирование

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

var a,b,c: integer;
begin
   writeln('vvedite chisla a, b, c');
   readln(a,b,c);
   if a>b then
     if b>c then
        writeln(b)
     else if c>a then
        writeln (c)
     else
            writeln(a)
   else if b<c then
        writeln(b)
     else if c<a then
        writeln(c)
     else
        writeln(a);
   readln();
end.
vedro-compota's picture

проверить для варианта:

2 1 3

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

var a,b,c: integer;
begin
  writeln('vvedite chisla a, b, c');
  readln(a,b,c);
     if (a>b)and(a<c) or (a<b)and(a>c) then
        writeln(a)
     else if (b>a)and(b<c) or (b<a)and(b>c) then
        writeln(b)
     else if (c>a)and(c<b) or (c<a)and(c>b) then
        writeln(c);
     readln();
end.