1)
var
count, num: integer;
begin
count := 0;
repeat
if (num > 0) and (num mod 2 = 0) then count := count + 1;
read(num);
until (num = 0);
write(count);
end.
2)
totalCount, count, num: integer;
totalCount := -1; count := 0; num := -1;
totalCount := totalCount + 1;
if (num mod 3 = 0) then count := count + 1;
write((count * 100) / totalCount, '%');
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
1)
var
count, num: integer;
begin
count := 0;
repeat
if (num > 0) and (num mod 2 = 0) then count := count + 1;
read(num);
until (num = 0);
write(count);
end.
2)
var
totalCount, count, num: integer;
begin
totalCount := -1; count := 0; num := -1;
repeat
totalCount := totalCount + 1;
if (num mod 3 = 0) then count := count + 1;
read(num);
until (num = 0);
write((count * 100) / totalCount, '%');
end.