PascalABCNET
1.
var a,b,c,i:integer;
begin
for i:=100 to 999 do
begin
a:= i div 100;
b:= i mod 100 div 10;
c:= i mod 10;
if (a+b+c) mod 3 = 0 then writeln(i)
end;
readln
end.
2.
var a,b,c,d,i:integer;
begin
for i:=1000 to 9999 do
begin
a:= i div 1000;
b:= i mod 1000 div 100;
c:= i mod 1000 mod 100 div 10;
d:= i mod 10;
if (a+d) mod 5 = 0 then writeln(i)
end;
readln
end.