program FindMinMax; var num1, num2, num3, num4, min, max: integer; begin writeln('Enter four integer numbers:'); readln(num1, num2, num3, num4); { Finding minimum } min := num1; if num2 < min then min := num2; if num3 < min then min := num3; if num4 < min then min := num4; { Finding maximum } max := num1; if num2 > max then max := num2; if num3 > max then max := num3; if num4 > max then max := num4; writeln('Minimum number is: ', min); writeln('Maximum number is: ', max); end.
Write, Run & Share Pascal code online using OneCompiler's Pascal online compiler for free. It's one of the robust, feature-rich online compilers for Pascal language. Getting started with the OneCompiler's Pascal editor is easy and fast. The editor shows sample boilerplate code when you choose language as Pascal and start coding.