Write a program to display on the screen all 3-digit numbers, multiples of 6 and 4
September 2, 2021 | education
| Write a program to display on the screen all 3-digit numbers, multiples of 6 and 4, and ending in digit 8. Write the program in three ways using for, while, repeat loops
program zz1;
var i: integer; // set a variable of integer type
begin
for i: = 100 to 999 do // 1 way
if (i mod 10 = 8) and (i mod 6 = 0) and (i mod 4 = 0) then write (”, i); // display the first answer
writeln;
i: = 100;
while i <= 999 do // 2nd way
begin
if (i mod 10 = 8) and (i mod 6 = 0) and (i mod 4 = 0) then write (”, i); // print the second answer
i: = i + 1;
end;
writeln;
i: = 100;
repeat // 3 way
if (i mod 10 = 8) and (i mod 6 = 0) and (i mod 4 = 0) then write (”, i); // print the third answer
i: = i + 1;
until i> 999;
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.