implicit none integer, parameter :: nmax=10 integer :: i,n real(8) :: poly,a(0:nmax),x print*,'Order of the polynomial'; read*,n if (n > nmax) then print*,'Order higher than nmax'; stop end if do i=0,n print*,'Give coefficient ',i; read*,a(i) end do print*,'Evaluate at x-value:'; read*,x print*,'Polynomial value is: ',poly(nmax,n,a,x) end function poly(nmax,n,a,x) implicit none integer :: i,n,nmax real(8) :: poly,a(0:nmax),x poly=0.0_8 do i=0,n poly=poly+a(i)*x**i end do end function poly