Skip to content

Instantly share code, notes, and snippets.

@drage0
Created March 21, 2016 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drage0/0634a2d0babf88acb18e to your computer and use it in GitHub Desktop.
Save drage0/0634a2d0babf88acb18e to your computer and use it in GitHub Desktop.
program c;
var n, m, i: integer;
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('n=');
readLn(n);
writeLn(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