Program urobi prevod cisla z desiatkovej do 16kovej sustavy
Delphi & Pascal (česká wiki)
Category: Homework in Pascal
Program: Do_hex.pas
Program: Do_hex.pas
Program urobi prevod cisla z desiatkovej do 16kovej sustavy.
program do_sestnast; var j,i,d:integer; z:array[1..16] of integer; procedure urob_prevod_16(d:integer); var i,j,c: integer; begin i:=16; c:=d; repeat z[i]:=c mod 16; c:=c div 16; i:=i-1; until C=0; end; begin write('Zadaj cislo v desiatkovej sustave :'); readln(d); urob_prevod_16(d); write('Zapis cisla ',D,' v sestnastkovej sustave je: '); for J:=I+1 to 16 do begin if(z[j]=15) then write('F'); if(z[j]=14) then write('E'); if(z[j]=13) then write('D'); if(z[j]=12) then write('C'); if(z[j]=11) then write('B'); if(z[j]=10) then write('A'); if(z[j]<10) then write(z[j]); end; writeln; readln; end.