procedure P(val I integer)
declare C, D integer
declare A integer array[0..7]
D <– 128
for C <– 0 upto 7 do
  A[7-C] <– I div D
  if A[7-C] = 1 then
    I <– I – D
  endif
  D <– D div 2
endfor
endprocedure P

The purpose of the algorithm is converting decimal number of 197 into binary 11000101

Tags: