Current location - Training Enrollment Network - Mathematics courses - Programming with C Language to Realize Qin Jiushao
Programming with C Language to Realize Qin Jiushao
/* Modify n, where n means that f(x) is a polynomial of degree n */

# Define n 5/* Set it to 5*/

# include & ltstdio.h & gt

void main()

{

float a[n],x,sum

int I;

The value of printf ("Please enter x=");

scanf("%f ",& ampx);

for(I = n; I & gt=0; I-)

{

Printf ("Please enter the value of a%d=", i);

scanf("%f ",& ampa[I]);

}

sum = a[n];

for(I = n; I>= 1; I-)

{

sum = sum * x+a[I- 1];

}

printf("f(x)=%f\n ",sum);

}

/* Learn from each other */