Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- x, min, max, digit: integer;
- begin
- readln(x);
- max := -1;
- min := 10;
- while (x > 0) do
- begin
- digit := x mod 10;
- if (digit mod 2 = 0) and (digit > max) then
- max := digit;
- if (digit mod 2 <> 0) and (digit < min) then
- min := digit;
- x := x div 10;
- end;
- if (max <> -1) then
- writeln(max);
- if (min <> 10) then
- writeln(min);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement