Задача 6 урок 9
Primary tabs
Пользователь вводит три числа, найдите из них максимальное.
Решите тремя способами:С использованием логической операции and.
С вложенными блоками (без and, все опараторы if должны быть в полной форме).
Без вложенных блоков (без and) -- запомнив максимум из первых двух чисел в специальной переменной.
var a, b, c: integer; begin readln(a, b, c); if (a>b) and (a>c) then write(a) else if (b>a) and (b>c) then write (b) else write (c); end. var a, b, c: integer; begin readln(a, b, c); if (a>b) then if (a>c) then write (a); if (b>a) then if (b>c) then write (b); if (c>a) then if (c>b) then write (c); end. var a, b, c, d: integer; begin readln(a, b, c); if (a>b) then d:=a else d:=b; if (c>d) then write (c) else write (d); end.
- Log in to post comments
- 253 reads