#include#include #include #define f(x) 3*x*x - 6*x + 2 int main() { int n; float x0,a[50],b[50]; a[0]=2; a[1]=-6; a[2]=3; clrscr(); n=2; //printf("Enter Degree of Polynomial : "); //scanf("%d", &n); printf("Enter the value at which polynomial is to be evaluated : "); scanf("%f", &x0); b[n] = a[n]; while(n>0){ b[n-1] = a[n-1]+b[n]*x0; n--; } printf("Value of polynomial f(%0.4f)=%0.4f",x0,b[0]); getch(); return 0; }
No comments:
Post a Comment