{convert the base 16 "1"s field into hex character and combine with "10"s}
case lessixteen of
0 : hx:=hx+'0';
1 : hx:=hx+'1';
2 : hx:=hx+'2';
3 : hx:=hx+'3';
4 : hx:=hx+'4';
5 : hx:=hx+'5';
6 : hx:=hx+'6';
7 : hx:=hx+'7';
8 : hx:=hx+'8';
9 : hx:=hx+'9';
10 : hx:=hx+'A';
11 : hx:=hx+'B';
12 : hx:=hx+'C';
13 : hx:=hx+'D';
14 : hx:=hx+'E';
15 : hx:=hx+'F';
else
end;
write (hx); {display the hex code converted from num}
end;

begin {the start of the program}
clrscr;
write('Enter a number to convert to disk hex: ');

{do the main calculations}
n4:=number div 16777216;
n4a:=number mod 16777216;
n3:=n4a div 65536;
n3a:=n4a mod 65536;
n2:=n3a div 256;
n2a:=n3a mod 256;
n1:=n2a;

{display results, have them converted to hex, and display in hex}
writeln('Original Number entered ',number);
writeln('base 10 [normal] ',n1:4,n2:4,n3:4,n4:4);
write('base 16 [hex] ');
num:=n1; {set what needs to be shown as hex}
hexit; {convert num to hex and show it}
write('-'); {display a seperator character}
num:=n2; {set what needs to be shown as hex}
hexit; {convert num to hex and show it}
write('-'); {display a seperator character}
num:=n3; {set what needs to be shown as hex}
hexit; {convert num to hex and show it}
write('-'); {display a seperator character}
num:=n4; {set what needs to be shown as hex}
hexit; {convert num to hex and show it}

writeln; writeln('Hit enter to exit');