1)
var
i, A, B, sum: integer;
begin
sum := 0;
read(A, B);
for i := A to B do
write(i, ' ');
sum := sum + i;
end;
writeln;
write(sum);
end.
2)
i, N, count, num: integer;
count := 0;
read(N);
for i := 1 to N do
read(num);
if (num mod 4 = 0) then count := count + 1;
if (count = 0) then
write('NO')
else
write(count);
3)
i, a, b, c, d: integer;
read(a, b, c, d);
for i := a to b do
if (i mod d = c) then write(i, ' ');
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
1)
var
i, A, B, sum: integer;
begin
sum := 0;
read(A, B);
for i := A to B do
begin
write(i, ' ');
sum := sum + i;
end;
writeln;
write(sum);
end.
2)
var
i, N, count, num: integer;
begin
count := 0;
read(N);
for i := 1 to N do
begin
read(num);
if (num mod 4 = 0) then count := count + 1;
end;
if (count = 0) then
write('NO')
else
write(count);
end.
3)
var
i, a, b, c, d: integer;
begin
read(a, b, c, d);
for i := a to b do
begin
if (i mod d = c) then write(i, ' ');
end;
end.