1.
var i,n:integer;
begin
write('Nhap n= '); readln(n);
for i:=0 to n do
if i mod 2 = 0 then write(i,' ');
end.
2.
var a,b,t:integer;
begin
write('Nhap a= '); readln(a);
write('Nhap b= '); readln(b);
if a>b then begin t:=a;
a:=b;
b:=t; end;
writeln('a= ',a);
writeln('b= ',b);
end.
1:
uses crt;
var n,i:integer;
begin
clrscr;
write('n='); readln(n);
if n<=0 then writeln('yeu cau ban nhap lai')
else
begin
writeln('cac so chan trong khoang tu 0 toi ',n,' la:');
for i:=0 to n do
if i mod 2=0 then write(i:4);
end;
readln;
end.
2:
uses crt;
var a,b,tam:integer;
begin
write('a='); readln(a);
write('b='); readln(b);
if a<=b then writeln('yeu cau ban nhap lai')
else
begin
tam:=a;
a:=b;
b:=tam;
writeln('gia tri cua a sau khi doi la: ',a);
writeln('gia tri cua b sau khi doi la: ',b);
end;
readln;
end.
1:
uses crt;
var n,i:integer;
begin
clrscr;
write('n='); readln(n);
if n<=0 then writeln('yeu cau ban nhap lai')
else
begin
writeln('cac so chan trong khoang tu 0 toi ',n,' la:');
for i:=0 to n do
if i mod 2=0 then write(i:4);
end;
readln;
end.
2:
uses crt;
var a,b,tam:integer;
begin
write('a='); readln(a);
write('b='); readln(b);
if a<=b then writeln('yeu cau ban nhap lai')
else
begin
tam:=a;
a:=b;
b:=tam;
writeln('gia tri cua a sau khi doi la: ',a);
writeln('gia tri cua b sau khi doi la: ',b);
end;
readln;
end.