Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

ConversionOfNumberSystems

program NumeralSystems;

const
 alf : array[0..15] of char = ('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
var
 i,c,m, s, tmp : longint;
 res : string;
begin
 writeln('Program was written by Paweł Bielecki 2017');
 writeln;
 readln(c); //count of data

 for i := 0 to c-1 do
 begin
   readln(m); //data (repeat c times)
   writeln(m, ':');
   for s := 2 to 16 do
   begin
      tmp := m;
      write(s, #32);
      res :='';
      repeat
        res :=  alf[tmp mod s] + res;
        tmp := tmp div s;
      until tmp = 0;
      writeln(res);
   end;
   writeln;
 end;
end.

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.