Решение 2 Задача 6 Урок 9
Primary tabs
Пользователь вводит три числа, найдите из них максимальное.
С вложенными блоками (без and).
var a, b, c: integer;
begin
writeln('Vvedite pervoe chislo (int) A =');
readln(a);
writeln('Vvedite vtoroe chislo (int) B =');
readln(b);
writeln('Vvedite tretye chislo (int) C =');
readln(c);
if (a > b) then
begin
if (a > c) then
begin
writeln(a, ' - maximalnoe chislo')
end
else if (c > a) then
begin
writeln(c, ' - maximalnoe chislo');
end
end
else if (b > a) then
begin
if (b > c) then
begin
writeln(b, ' - maximalnoe chislo');
end
else
begin
writeln(c, ' - maximalnoe chislo');
end;
end;
readln();
end.КОНСОЛЬ
Vvedite pervoe chislo (int) A = 100 Vvedite vtoroe chislo (int) B = 200 Vvedite tretye chislo (int) C = 300 300 - maximalnoe chislo
- Log in to post comments
- 1877 reads
vedro-compota
Sun, 10/03/2021 - 12:09
Permalink
if (a > b) then
есть лишняя проверка
_____________
матфак вгу и остальная классика =)
Vitaliy123
Sun, 10/03/2021 - 12:16
Permalink
Исправленная версия 1
var a, b, c: integer; begin writeln('Vvedite pervoe chislo (int) A ='); readln(a); writeln('Vvedite vtoroe chislo (int) B ='); readln(b); writeln('Vvedite tretye chislo (int) C ='); readln(c); if (a > b) then begin if (a > c) then begin writeln(a, ' - maximalnoe chislo') end else begin writeln(c, ' - maximalnoe chislo'); end end else if (b > a) then begin if (b > c) then begin writeln(b, ' - maximalnoe chislo'); end else begin writeln(c, ' - maximalnoe chislo'); end; end; readln(); end.vedro-compota
Sun, 10/03/2021 - 12:28
Permalink
решение засчитано
решение засчитано
_____________
матфак вгу и остальная классика =)