uses wincrt;

const
  colors: array[-2..10] of string = (
      'Silver',
      'Gold',
      'Black',
      'Brown',
      'Red',
      'Orange',
      'Yellow',
      'Green',
      'Blue',
      'Violet',
      'Gray',
      'White',
      'no color band');

  tolerance: array[-2..1] of string = (
      '±10%','±5%','±1%','±2%');

function pwr10(x:integer):real; {pwr10 := 10^x}
  begin
    pwr10 := exp(x * ln(10));
  end;

var band: array[1..5] of integer;
    i:integer;

begin
  writeln('Color Codes:');
  for i := -2 to 10 do
    begin
      writeln(i:4,' = ',colors[i]);
    end;

  writeln;
  writeln('Enter Resistor Color Codes:');

  for i := 1 to 5 do
    begin
      write('  ',i:2,': '); readln(band[i]);
    end;

  writeln;

  if band[5]=10 then
    writeln('The resistor value is: ',(band[1]*10+band[2])*pwr10(band[3]):2,' ',
            tolerance[band[4]])
  else
    writeln('The resistor value is: ',(band[1]*100+band[2]*10+band[3])*pwr10(band[4]):3,
            ' ',tolerance[band[5]]);
end.
