a,b,c,i,n,p,s:integer; x:real; p1,g:string; begin readln(a); writeln('is kakoi perevodim?'); readln(b); if b=10 then begin writeln('v kakoi perevodim?'); readln(c); end; n:=0; p:=0; if b<>10 then begin repeat x:=exp(ln(b)*n); s:=Round(x); p:=p + (a mod 10)*s; a:= a div 10; n:=n+1; until a=0; end else begin repeat g:=IntToStr(a mod c); p1:=p1 + g; a:=a div c; until a<c; p1:=p1+IntToStr(a); end; if p=0 then begin for i:=1 to length(p1) do write(p1[length(p1)-i+1]); end else write(p); end.
Answers & Comments
var
a,b,c,i,n,p,s:integer;
x:real;
p1,g:string;
begin
readln(a);
writeln('is kakoi perevodim?');
readln(b);
if b=10 then begin
writeln('v kakoi perevodim?');
readln(c);
end;
n:=0;
p:=0;
if b<>10 then begin
repeat
x:=exp(ln(b)*n);
s:=Round(x);
p:=p + (a mod 10)*s;
a:= a div 10;
n:=n+1;
until a=0;
end
else begin
repeat
g:=IntToStr(a mod c);
p1:=p1 + g;
a:=a div c;
until a<c;
p1:=p1+IntToStr(a);
end;
if p=0 then begin
for i:=1 to length(p1) do
write(p1[length(p1)-i+1]);
end
else
write(p);
end.