Integers x and y are given. Write a program for determining the sign of the difference x-y.
Integers x and y are given. Write a program for determining the sign of the difference x-y. The difference cannot be calculated. It is allowed to compare the numbers x and y with zero, but only the absolute values of the numbers x and y can be compared with each other.
program zz1;
var x, y: integer; // set variables of integer type
begin
write (‘enter the first number x’); // enter the first number from the keyboard
read (x);
write (‘enter the second number y’); // enter the second number from the keyboard
read (y);
if x = y then write (‘the sign of the difference x – y will not be’)
else
if (x> y) // check the condition, if the first number is greater than the other, then
then write (‘the sign of the difference x – y will be positive’) // print one answer
else write (‘the sign of the difference x – y will be negative’); // print another answer
end.