Horners method - c program, Public Economics

Horners method -  C program:

Modify the program to implement the details for the recursive function called horners(double b, int n) that calculates Horner's method for a coefficient of 1 and a given value of b and for integer n. Horner's method for this problem is define as 1 + b * (1 + b * (1 + b * ( 1 + . . . + b))).

#include

#include

#include

#include

using namespace std;

double horners(double b, int n);

int main(int argc, char **argv)

{

             cout << "horners(2, 4)  = " << horners(2, 4) << endl;

             cout << "horners(3, 2)  = " << horners(3, 2) << endl;

             cout << "horners(5, 5)  = " << horners(5, 5) << endl;

             cout << "horners(10, 3) = " << horners(10, 3) << endl;

             cout << "horners(13, 2) = " << horners(13, 2) << endl;

             cout << endl << "Press any key to continue." << endl;

            getchar();

   return 0;

}

double horners(double b, int n)

{

   //     using recursive definition

  //       1 + b * (1 + b * (1 + b * ( 1 + . . . + b)));   

    return 0.0;

}

/*

Output will be

horners(2, 4) = 31

horners(3, 2) = 13

horners(5, 5) = 3906

horners(10, 3) = 1111

horners(13, 2) = 183

Posted Date: 2/11/2013 5:46:17 AM | Location : United States







Related Discussions:- Horners method - c program, Assignment Help, Ask Question on Horners method - c program, Get Answer, Expert's Help, Horners method - c program Discussions

Write discussion on Horners method - c program
Your posts are moderated
Related Questions
why is public finance important?

Discuss whether high indirect taxes are the best way to discourage smoking.

Select a current political, social or environmental issue that is receiving coverage in the media, or choose an organisation you feel needs a better public relations approach, and

Question 1: Examine the essential elements of modern democratic societies. Question 2: State the various ways in which the participation of people is achieved in a demo

1. If GDP is not a good measure of economic well-being, why then it is always used by the president in his/her STATE OF THE NATION''S ADDRESS?



Suppose the firm mark up over the cost is 10% and the wage setting equation is W=P (1-u) where U is the unemployment rate. a) Find out the real wage rate implied by the price se

The term Public Economics came into existence only in 1960s however a few titleswith nomenclature such as Public Finance had already started covering much ground,which is today cov

With a background from the previous section we now study some of the critical characteristics of policy process. You have already studied earlier various technical theories relatin