Bài 1:
uses crt;
var s,i:integer;
begin
clrscr;
s:=0;
for i:=3 to 372 do
if i mod 3=0 then s:=s+i;
writeln(s);
readln;
end.
Bài 2:
uses crt;
var n,i,t,x,y,d:integer;
st:string;
begin
clrscr;
write('Nhap n='); readln(n);
str(n,st);
t:=0;
d:=length(st);
for i:=1 to d do
begin
val(st[i],x,y);
t:=t+x;
end;
writeln(t);
readln;
end.