program ExchangeVariables;
varx, y: integer;
beginwrite('Enter the value of x: ');readln(x);write('Enter the value of y: ');readln(y);
writeln('Before exchange:');writeln('x = ', x);writeln('y = ', y);
x := x + y;y := x - y;x := x - y;
writeln('After exchange:');writeln('x = ', x);writeln('y = ', y);end.
program ExchangeVariables;
var
x, y: integer;
begin
write('Enter the value of x: ');
readln(x);
write('Enter the value of y: ');
readln(y);
writeln('Before exchange:');
writeln('x = ', x);
writeln('y = ', y);
x := x + y;
y := x - y;
x := x - y;
writeln('After exchange:');
writeln('x = ', x);
writeln('y = ', y);
end.