Created
March 24, 2016 11:30
-
-
Save drage0/977a6fe3a58ff4d92a30 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program c; | |
var n, m, i: longint; | |
function brf(n: integer; b: boolean): integer; | |
begin | |
if b then brf := 1 | |
else brf := 0; | |
while(n > 0) do begin | |
if(b) then brf := brf * 10 | |
else brf := brf + 1; | |
n := n div 10; | |
end; | |
end; | |
procedure cikld(var n: integer); | |
var x, k: integer; | |
begin | |
k := brf(n, true); | |
x := n mod 10; | |
n := n div 10; | |
n := n + x*(k div 10); | |
end; | |
begin | |
write('m='); | |
readLn(m); | |
n := m; | |
for i:=1 to m-1 do begin | |
n := n*10 + (m mod 10 - i); | |
end; | |
writeLn('Formed: ', n); | |
for i:=1 to brf(n, false) do begin | |
cikld(n); | |
writeLn(n); | |
end; | |
readLn(); | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment