program assignment1_2;

type coeffs = array [0..10] of integer;

var a:coeffs;
    p, x:real;

procedure eval(n:integer; a:coeffs; x, p_in:real; var p_out:real);

var i:integer;

begin

  p_out:=p_in*x+a[n];
  n:=n-1;

  if n>=0 then eval(n,a,x,p_out,p_out);

end;

begin

  a[0]:=4;
  a[1]:=-3;
  a[2]:=2;
  a[3]:=-1;
  a[4]:=2;

  writeln('What Value of x would you like?');
  readln(x);

  eval(4,a,x,0,p);

  writeln('Tada: ',p:10:4);

  readln;

end.
