% hw0055.m
% John Burkardt
% Evaluate 8 digit binary number.
%
a = input ( 'Enter a: ' );
b = input ( 'Enter b: ' );
c = input ( 'Enter c: ' );
d = input ( 'Enter d: ' );
e = input ( 'Enter e: ' );
f = input ( 'Enter f: ' );
g = input ( 'Enter g: ' );
h = input ( 'Enter h: ' );
%
%  N will hold our result.
%
n = 0;

if ( h == 1 )
  n = n + 1;
end
if ( g == 1 )
  n = n + 2;
end
if ( f == 1 )
  n = n + 4;
end
if ( e == 1 )
  n = n + 8;
end
if ( d == 1 )
  n = n + 16;
end
if ( c == 1 )
  n = n + 32;
end
if ( b == 1 )
  n = n + 64;
end
if ( a == 1 )
  n = n + 128;
end

fprintf ( '  The value of %d%d%d%d%d%d%d%d is %d\n', a, b, c, d, e, f, g, h, n );

