Program Chuyencoso;
Var n:String;
Cs16:array[0..15] Of String=
('0','1','2','3',
'4','5','6','7',
'8','9','A','B',
'C','D','E','F') ;
Gtcs2:array[0..15] Of String=
('0000','0001','0010','0011',
'0100','0101','0110','0111',
'1000','1001','1010','1011',
'1100','1101','1110','1111');
Procedure Chuyen2s16(n:string);
Var i:integer;
m,s1,KQ:string;
Begin
m:=n;
While (length(m )mod 4<>0) do m:='0'+m;
// writeln(m,'--------------------');
s1:='';
KQ:='';
Repeat
s1:=Copy(m,1,4);
For i:=0 to 15 do If Gtcs2[i]=s1 then break;
KQ:=KQ+Cs16[i];
Delete(m,1,4);
Until m='';
writeln(KQ);
End;
BEGIN
Write('Nhap so nhi phan:');
readln(n);
Writeln('Chuyen tu co so 2 sang 16');
Chuyen2s16(n);
readln
END.