Algorithm:
Step 1. Read x,n
Step2.
for i=1 to (n+1) is steps of 1 do Read xi,fi end for {the above statements
reads x,s and the corresponding values of f is }
Step 3. Sum=0
Step
4. for i=1 to (n+1) in steps of 1 do
Step
5. Profvnc=1
Step 6. for J=1 to
(n+1) in steps of 1 do
Step
7. If (j≠i) then prodfunc=prodfunc X(x-xj) / (xi-xj) endfor
Step 8. Sum=Sum+fi x Prodfunc {sum is the
value of f at x} end for
Step 9. Write x, sum
Step 10. STOP
No comments:
Post a Comment