1.
var a,k: integer;
begin
k:=0;
readln(a);
while a<>0 do
if a mod 4 = 0 then k:=k+1;
end;
writeln('k = ',k);
end.
Пример:
5
20
24
0
k = 2
2.
if (a>9)and(a<100)and(a mod 10 = 4) then k:=k+1;
204
4
k = 1
Вот держите:
var a,k:integer;
repeat
if a mod 3 = 0 then inc(k);
until a=0;
writeln(k-1);
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
1.
var a,k: integer;
begin
k:=0;
readln(a);
while a<>0 do
begin
if a mod 4 = 0 then k:=k+1;
readln(a);
end;
writeln('k = ',k);
end.
Пример:
5
20
24
0
k = 2
2.
var a,k: integer;
begin
k:=0;
readln(a);
while a<>0 do
begin
if (a>9)and(a<100)and(a mod 10 = 4) then k:=k+1;
readln(a);
end;
writeln('k = ',k);
end.
Пример:
5
20
24
204
4
0
k = 1
Verified answer
Вот держите:
var a,k:integer;
begin
repeat
readln(a);
if a mod 3 = 0 then inc(k);
until a=0;
writeln(k-1);
end.