Câu 1:
uses crt;
var t:real;
i:integer;
begin
clrscr;
t:=0;
for i:=1 to 100 do
t:=t+(sqr(i) mod (2*i));
writeln('So tien sau cung la: ',t:0:0);
readln;
end.
Câu 2:
const fi='dxau.inp'
fo='dxau.out'
var f1,f2:text;
st:string;
x:char;
dem,i,d:integer;
a:array[1..255]of integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,st);
readln(f1,x);
d:=length(st);
dem:=0;
for i:=1 to d do
if st[i]=x then
begin
inc(dem);
a[dem]:=i;
end;
if dem=0 then writeln(f2,'Khong co')
else begin
writeln(f2,dem);
for i:=1 to dem do
write(f2,a[i]:4);
end;
close(f1);
close(f2);
end.