Задача 9 Урок 9
Primary tabs
Пользователь вводит четыре числа, найдите из них максимальное -- решите через вложенные блоки if в полной форме (без использования логических операций).
var a, b, c, d:Integer;
begin
writeln('Input 4 numbers:');
readln(a, b, c, d);
if (a>b) then
if (a>c) then
if (a>d) then
writeln('Max number is ', a)
else writeln('Max number is ', d)
else if (c > d) then
writeln('Max number is ', c)
else writeln(d)
else if (b>c) then
if (b>d) then
writeln('Max number is ', b)
else writeln(d)
else if (c>d) then
writeln('Max number is ', c)
else writeln('Max number is ', d) ;
readln();
end.- Log in to post comments
- 501 reads