(NUMERICAL METHOD) HORNER’S METHOD OF FINDING POLYNOMIAL AT GIVE VALUE C-PROGRAMMING
#include<stdio.h>
#include<conio.h>
#include<math.h>
#define G(x) (x)*(x)*(x)-4*(x)*(x)+(x)+6
void main()
{
int n,i;
float x, a[10],p;
printf("--------------------------------------------------------------\n");
printf("HORNER'S METHOD OF FINDING THE POLYNOMIAL VALUE AT GIVEN POINT\n");
printf("--------------------------------------------------------------\n\n");
printf("\nINPUT DEGREE OF POLYNOMIAL:\t");
scanf("%d", &n);
printf("\nINPUT POLYNOMIAL COEFFICENTS WITH ORDER a[%d] to a[0]:\t", n);
for(i=n; i>=0; i--)
scanf("%f", &a[i]);
printf("\nTHE POLYNOMIAL IS:\t");
for(i=n; i>=0; i--)
{
printf("%f(x^%d) ",a[i],i);
}
printf("\n\nINPUT VALUE OF 'X' (EVALUATION POINT):\t");
scanf("%f", &x);
p=a[n];
for(i=n-1; i>=0; i--)
{
p=p*x+a[i];
}
printf("\nTHE POLYNOMIAL VALUE: f(x) = %f at x = %f\t", p,x);
}
CLICK HERE:
#include<stdio.h>
#include<conio.h>
#include<math.h>
#define G(x) (x)*(x)*(x)-4*(x)*(x)+(x)+6
void main()
{
int n,i;
float x, a[10],p;
printf("--------------------------------------------------------------\n");
printf("HORNER'S METHOD OF FINDING THE POLYNOMIAL VALUE AT GIVEN POINT\n");
printf("--------------------------------------------------------------\n\n");
printf("\nINPUT DEGREE OF POLYNOMIAL:\t");
scanf("%d", &n);
printf("\nINPUT POLYNOMIAL COEFFICENTS WITH ORDER a[%d] to a[0]:\t", n);
for(i=n; i>=0; i--)
scanf("%f", &a[i]);
printf("\nTHE POLYNOMIAL IS:\t");
for(i=n; i>=0; i--)
{
printf("%f(x^%d) ",a[i],i);
}
printf("\n\nINPUT VALUE OF 'X' (EVALUATION POINT):\t");
scanf("%f", &x);
p=a[n];
for(i=n-1; i>=0; i--)
{
p=p*x+a[i];
}
printf("\nTHE POLYNOMIAL VALUE: f(x) = %f at x = %f\t", p,x);
}
CLICK HERE:
(NUMERICAL METHOD) HORNER’S METHOD OF FINDING POLYNOMIAL AT GIVE VALUE C-PROGRAMMING
Reviewed by Unknown
on
April 06, 2018
Rating:
No comments: