1...
program bai1;
var s,i,n:longint;
begin
write('N= ');
readln(n);
s:=0;
for i:=1 to n do
if i mod 2<>0 then s:=s+i;
write('s= ',s);
readln
end.
program bai2;
var s,i,n:longint;
begin
write('N= ');
readln(n);
s:=0;
for i:=1 to n do
if i mod 2=0 then s:=s+i;
write('s= ',s);
readln
end.
1.
program tong_le;
uses crt;
var s,n,i:integer;
begin
clrscr;
s:=0;
write('nhap n:');readln(n);
for i:=1 to n do
if i mod 2<>0 then s:=s+i;
writeln('tong s la:',s);
readln
end.
2.
bn khai báo như ở trên
begin
clrscr;
s:=0;
write('nhap n:');readln(n);
for i:=1 to n do
if i mod 2=0 then s:=s+i;
writeln('tong s la:',s);
readln
end.
XONG RÙI ĐÓ!!
1.
program tongle;
uses crt;
var i,s,n:integer;
begin
clrscr;
s:=0;
write('nhap n:');readln(n);
for i:=1 to n do
if i mod 2<>0 then s:=s+i;
writeln('tong s la:',s);
readln
end.
2.
program tongchan;
uses crt;
var i,s,n:integer;
begin
clrscr;
s:=0;
write('nhap n:');readln(n);
for i:=1 to n do
if i mod 2=0 then s:=s+i;
writeln('tong s la:',s);
readln
end.
XONG RÙI!!!