program horner;
uses crt;
var
i,n : integer;
a : array [1..10] of real;
temp,x : real;
begin
clrscr;
write('banyak ordo : ');readln(n);
for i:=n downto 1 do
begin
write('nilai ordo untuk x^',i-1,' : ');readln(a[i]);
end;
write('p(x) = ');
for i:=n downto 2 do
begin
if i=2 then
write(a[i]:0:3,' x + ')
else
write(a[i]:0:3,' x^',i-1,' + ');
end;
writeln(a[1]:0:3);
write('nilai f(x) berapa yang akan dicari x= ');readln(x);
temp:=0;
for i:=n downto 2 do
begin
temp:= (temp+a[i])*x;
end;
temp:=temp+a[1];
writeln('nilai f(',x:0:5,') = ',temp:8:5);
readln
end.