A natural three-digit number N is given. Write a program that outputs a four-digit number obtained by assigning the digit
A natural three-digit number N is given. Write a program that outputs a four-digit number obtained by assigning the digit of the digit of the units of the original number to it on the left (in the digit of thousands). Using text files input, output.
program zz1;
var
n, i, s: integer; // set variables of integer type
f1, f2: text; // set a variable of the text type to work with the file
begin
assign (f1, ‘input.txt’); // bind a variable of the text type to the file
reset (f1); // open the file for reading
assign (f2, ‘output.txt’);
rewrite (f2); // open the file for writing
read (f1, n);
s: = n mod 10; // get the last digit
n: = n + s * 1000; // assign it to a number
write (f2, n); // display the answer
close (f1); // close the file input
close (f2); // close the file output
end.