C program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thyagi1
    New Member
    • Nov 2007
    • 2

    #1

    C program

    Write a function which will tabulate values of any given function from a given starting
    value up to (and including) a given final value. The size of the each step from the
    starting value to the final value should also be a parameter of the function.

    For example,
    #define PI 3.14159
    tab_func(sin, 0.0, PI, PI/8.0);

    would print
    x f(x)
    ----------------------------------
    0.0000 0.0000
    0.3927 0.3827
    0.7854 0.7071
    1.1781 0.9239
    1.5708 1.0000
    1.9635 0.9239
    2.3562 0.7071
    2.7489 0.3827
    3.1416 0.0000
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    Originally posted by thyagi1
    Write a function which will tabulate values of any given function from a given starting
    value up to (and including) a given final value. The size of the each step from the
    starting value to the final value should also be a parameter of the function.

    For example,
    #define PI 3.14159
    tab_func(sin, 0.0, PI, PI/8.0);

    would print
    x f(x)
    ----------------------------------
    0.0000 0.0000
    0.3927 0.3827
    0.7854 0.7071
    1.1781 0.9239
    1.5708 1.0000
    1.9635 0.9239
    2.3562 0.7071
    2.7489 0.3827
    3.1416 0.0000

    Hi,
    Please read posting guidelines before posting and dont expect we can write the code for you

    Raghuram

    Comment

    Working...