Var a,b,c,d,e:integer; begin writeln('введите четырёхзначное число'); readln(a); b:=a mod 10; a:=a div 10; write(b); c:=a mod 10; a:=a div 10; write(c); d:=a mod 10; write(d); a:=a div 10; write(a); end.
open System; [<EntryPoint>] let main argv = let rec getNumberFromConsole _ = printf "Please enter a correct 4-digits number?\n" let maybeInt = Console.ReadLine(); let mutable value = 0; if Int32.TryParse(maybeInt, &value) && value >= 1000 && value <= 9999 then value else (getNumberFromConsole null) let rec power = function | (x, 0) -> 1 | (x, n) -> x * power (x, n-1) let getDigit sourceNumber digit = (sourceNumber / (power (10, digit))) % 10 let number = getNumberFromConsole null let resultNumber = getDigit number 0 * 1000 + getDigit number 1 * 100 + getDigit number 2 * 10 + getDigit number 3 printf "%d" resultNumber Console.ReadKey true |> ignore 0
begin
writeln('введите четырёхзначное число');
readln(a);
b:=a mod 10;
a:=a div 10;
write(b);
c:=a mod 10;
a:=a div 10;
write(c);
d:=a mod 10;
write(d);
a:=a div 10;
write(a);
end.
open System;
[<EntryPoint>]
let main argv =
let rec getNumberFromConsole _ =
printf "Please enter a correct 4-digits number?\n"
let maybeInt = Console.ReadLine();
let mutable value = 0;
if Int32.TryParse(maybeInt, &value) && value >= 1000 && value <= 9999
then value
else (getNumberFromConsole null)
let rec power = function
| (x, 0) -> 1
| (x, n) -> x * power (x, n-1)
let getDigit sourceNumber digit =
(sourceNumber / (power (10, digit))) % 10
let number = getNumberFromConsole null
let resultNumber = getDigit number 0 * 1000 + getDigit number 1 * 100 + getDigit number 2 * 10 + getDigit number 3
printf "%d" resultNumber
Console.ReadKey true |> ignore
0