Write a program that in a sequence of natural numbers determines the number of three-digit numbers

Write a program that in a sequence of natural numbers determines the number of three-digit numbers divisible by 4. The program receives natural numbers as input, the number of entered numbers is unknown, the sequence of numbers ends with the number 0 (0 is the sign of the end of the input, not included in the sequence). The number of numbers does not exceed 1000. The entered numbers do not exceed 30,000. The program should output one number: the number of three-digit numbers divisible by 4.

Program fghj;
var
a, k, n: integer;
begin
a: = 1;
while a <> 0 do
begin
writeln (‘Enter a number in the range (0; 30000):’);
readln (a);
if a <> 0 then
begin
if (a div 1000 = 0) and (a mod 4 = 0) then k: = k + 1;
n: = n + 1
end;
if n = 1000 then
begin
a: = 0;
writeln (‘The number of numbers is 1000, the process stops’);
end;
end;
writeln (‘The number of three-digit numbers divisible by 4 is equal to:’, k);
readln;
end.

To select three-digit numbers among the entered numbers, we use the operation of separating the integer part from division by 1000 (a div 1000) – such an integer part must be equal to 0 for a three-digit number. We find numbers that are multiples of 4 by separating the remainder from division by 4, it must also be zero for integer division (a mod 4 = 0).
The solution uses the loop operator with the precondition while a <> 0 do …, as soon as 0 is entered from the keyboard, the loop will end.



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.