program CountDigits;
varnum, count: integer;
beginwriteln('Enter a natural number: ');readln(num);
count := 0;
while num > 0 dobeginnum := num div 10;count := count + 1;end;
writeln('Number of digits: ', count);end.
program CountDigits;
var
num, count: integer;
begin
writeln('Enter a natural number: ');
readln(num);
count := 0;
while num > 0 do
begin
num := num div 10;
count := count + 1;
end;
writeln('Number of digits: ', count);
end.