program SwapFirstLastDigit;varnum, newNum, firstDigit, lastDigit: integer;beginwrite('Enter a three-digit number: ');readln(num);
if (num < 100) or (num > 999) thenbeginwriteln('Please enter a valid three-digit number.');exit;end;
lastDigit := num mod 10;firstDigit := num div 100;
newNum := lastDigit 100 + (num mod 100 div 10) 10 + firstDigit;
writeln('Number with swapped first and last digit: ', newNum);end.
program SwapFirstLastDigit;
var
num, newNum, firstDigit, lastDigit: integer;
begin
write('Enter a three-digit number: ');
readln(num);
if (num < 100) or (num > 999) then
begin
writeln('Please enter a valid three-digit number.');
exit;
end;
lastDigit := num mod 10;
firstDigit := num div 100;
newNum := lastDigit 100 + (num mod 100 div 10) 10 + firstDigit;
writeln('Number with swapped first and last digit: ', newNum);
end.