2 câu trả lời
program ct;
uses crt;
var i,n:integer;
s:longint;
begin clrscr;
writeln('Nhap so n: '); readln(n);
s:=0;
for i:=1 to n do
if i mod 2<>0 then s:=s+i-(i+1);
write('Tong s la: ',s);
readln;
end.
Học tốt!
uses crt;
var i,n , s : longint;
begin clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
if i mod 2=0 then s:=s-i else s:=s+i ;
write('Tong la :', s);
readln
end.