begin writeln('Enter a four-digit number: '); readln(num);
// Calculate the sum of the first two digits firstSum := (num div 1000) + ((num div 100) mod 10);
// Calculate the sum of the last two digits lastSum := ((num div 10) mod 10) + (num mod 10);
// Check if the sums are equal if firstSum = lastSum then writeln('The sum of the first two digits is equal to the sum of the last two digits.') else writeln('The sum of the first two digits is not equal to the sum of the last two digits.'); end.
program SumDigits;
var
num, firstSum, lastSum: integer;
begin
writeln('Enter a four-digit number: ');
readln(num);
// Calculate the sum of the first two digits
firstSum := (num div 1000) + ((num div 100) mod 10);
// Calculate the sum of the last two digits
lastSum := ((num div 10) mod 10) + (num mod 10);
// Check if the sums are equal
if firstSum = lastSum then
writeln('The sum of the first two digits is equal to the sum of the last two digits.')
else
writeln('The sum of the first two digits is not equal to the sum of the last two digits.');
end.