Question #52786

Write a function that computes the value of the polynomial 3x5+2x4-5x3-x2+7x-6 . Write a program that asks the user to enter a value for , calls the function to compute the value of the polynomial, and display the value returned by the function.

Expert's answer

#include <stdio.h>

// Function for computing the value of the polynomial

double function(double x)

{

return 3*x*x*x*x*x + 2*x*x*x*x - 5*x*x*x - x*x + 7*x - 6;

}

int main()

{

double x;

scanf("%lf", &x);

// Calling the function and saving the answer

double answer = function(x);

printf("Answer = %lf", answer);

return 0;

}

// Function for computing the value of the polynomial

double function(double x)

{

return 3*x*x*x*x*x + 2*x*x*x*x - 5*x*x*x - x*x + 7*x - 6;

}

int main()

{

double x;

scanf("%lf", &x);

// Calling the function and saving the answer

double answer = function(x);

printf("Answer = %lf", answer);

return 0;

}

Learn more about our help with Assignments: C

## Comments

## Leave a comment