Câu 1 :
uses crt;
var a : array[1..100] of integer;
i,n,t : integer;
begin clrscr;
t:=0;
assign(input,'DULIEU.INP');
assign(output,'DULIEU.OUT');
reset(input); rewrite(output);
read(input,n);
for i:=1 to n do read(input,a[i]);
for i:=1 to n do if a[i] mod 5 <> 0 then t:=t+a[i];
write(output,t);
close(input); close(output);
readln
end.
Câu 2 :
uses crt;
var a : array[1..100] of integer;
i,n,t,j : integer;
begin clrscr;
t:=0; j:=0;
assign(input,'DULIEU.INP');
assign(output,'DULIEU.OUT');
reset(input); rewrite(output);
read(input,n);
for i:=1 to n do read(input,a[i]);
for i:=1 to n do if a[i] mod 2 <> 0 then begin
j:=j+1;
t:=t+a[i];
end;
write(output,t/j);
close(input); close(output);
readln
end.
Câu 3 :
uses crt;
var a : array[1..100] of integer;
i,n,t,j : integer;
begin clrscr;
t:=0; j:=0;
assign(input,'DULIEU.INP');
assign(output,'DULIEU.OUT');
reset(input); rewrite(output);
read(input,n);
for i:=1 to n do read(input,a[i]);
for i:=1 to n do if a[i] mod 2 = 0 then begin
j:=j+1;
t:=t+a[i];
end;
write(output,t/j);
close(input); close(output);
readln
end.