uses crt;
var st:string;
i,j,n,d,x,y:integer;
kq,lt:longint;
begin
clrscr;
write('nhap so nhi phan:'); readln(st);
d:=length(st);
kq:=0;
for i:=1 to d do
begin
lt:=1;
for j:=1 to d-i do
lt:=lt*2;
val(st[i],x,y);
kq:=kq+x*lt;
end;
writeln(st,' doi sang he 10 la: ',kq);
readln;
end.
Program andanh;
Uses Crt;
Var d:array[1..20] of byte;
i,j,n:integer;
Begin
Clrscr;
Write('so thap phan: '); Readln(n);
i:=1;
Repeat
d[i]:=n mod 2;
n:=n div 2;
i:=i+1;
Until(n=0);
Write('So nhi phan la: ');
For j:=i-1 downto 1 do
Write (d[j]);
readln;
End.