Написать программу, которая выводит шестнадцатеричное представление введенного с клавиатуры двоичного числа. для delphi нужен код программы от начала до конца
Var C:string; i:integer; begin Read(C); if Length(C) mod 4 <> 0 then For i:= 1 to 4-Length(C) mod 4 do C:='0'+C; For i:= 1 to Length(C) div 4 do Case StrToInt(C[4*i-3]+C[4*i-2]+C[4*i-1]+C[4*i]) of 0000:Write(0); 0001:Write(1); 0010:Write(2); 0011:Write(3); 0100:Write(4); 0101:Write(5); 0110:Write(6); 0111:Write(7); 1000:Write(8); 1001:Write(9); 1010:Write('A'); 1011:Write('B'); 1100:Write('C'); 1101:Write('D'); 1110:Write('E'); 1111:Write('F'); End; ReadLn; end.
uses
SysUtils;
Var
C:string;
i:integer;
begin
Read(C);
if Length(C) mod 4 <> 0 then
For i:= 1 to 4-Length(C) mod 4 do
C:='0'+C;
For i:= 1 to Length(C) div 4 do
Case StrToInt(C[4*i-3]+C[4*i-2]+C[4*i-1]+C[4*i]) of
0000:Write(0);
0001:Write(1);
0010:Write(2);
0011:Write(3);
0100:Write(4);
0101:Write(5);
0110:Write(6);
0111:Write(7);
1000:Write(8);
1001:Write(9);
1010:Write('A');
1011:Write('B');
1100:Write('C');
1101:Write('D');
1110:Write('E');
1111:Write('F');
End;
ReadLn;
end.