Blogger news

Followers

Thursday, August 29, 2013
Design, develop and execute a program in C to evaluate the given polynomial f(x)=a4x4+a3x3+a2x2+a1x+a0
for given value of x and the coefficients using Horner's method

Program No:4
=============
 #include<stdio.h>
 #include<conio.h>

 void main() // Calling Main Function
  {
    float a[100],x,sum=0;
    int i,n;
    clrscr();

    printf("Enter the power of polinomial equation");
    scanf("%d",&n);

    printf("Enter the values of X \n");
    sanf("%f",&x);

    printf("enter the values for co-efficients \n");

    for(i=n;i>0;i--)
    {
      scanf("%f",&a[i]);
    }

    for(i=n;i>0;i--)
    {
     sum=(sum+a[i])*x;
    }
     sum=sum+a[0];
    printf("\n the values of f(%.2f) sum=%.2f",x,sum);


    getch();
  }

===========
Program Ends

 CLICKHERE! TO DOWNLOAD THIS PROGRAM

To more reference Wikipedia link
Screenshots:



1 comments:

Unknown said...

:-)