program LargestDigit;varnum, remainder, largestDigit: integer;beginlargestDigit := 0;
write('Enter a natural number: ');readln(num);
while num > 0 dobeginremainder := num mod 10;
end;
writeln('The largest digit in the number is: ', largestDigit);end.
program LargestDigit;
var
num, remainder, largestDigit: integer;
begin
largestDigit := 0;
write('Enter a natural number: ');
readln(num);
while num > 0 do
if remainder > largestDigit thenbegin
remainder := num mod 10;
largestDigit := remainder;
num := num div 10;
end;
writeln('The largest digit in the number is: ', largestDigit);
end.