bài này có 2 cách:
cách 1: sử dụng chương trình con
uses crt;
var x,y,s: integer;
procedure nhap;
var x,y: integer;
begin
write ('nhap x: '); readln (x);
write ('nhap y: '); readln (y);
end;
procedure tinh;
var x,y,s: integer;
begin
s:=0
s:=x+y;
end;
begin
clrscr;
nhap;
tinh;
writeln ('tong la: ',s);
readln;
end.
cách 2: làm theo đơn giản
uses crt;
var x,y,s: integer;
begin
clrscr;
write ('nhap x: '); readln (x);
write ('nhap y: '); readln (y);
s:=x+y;
writeln ('tong la: ',s);
readln;
end.