Write a function to compute the value of the following series.
f(x, y) = y( ((1/1) - (1/3)) + ((1/5) - (1/7)) + ((1/9) - (1/11)) ... + (1/(4x-3) - 1/(4x-1)) )


where the values x and y are given by the user. The main function should continue to query the user for values of x and y until the x is entered as a zero. For example, if x=3 and y=2, the series is:
f(3, 2) = 2*( ((1/1) - (1/3)) + ((1/5) - (1/7)) + ((1/(4*3-3) - (1/(4*3-1))
f(3, 2) = 2*( ((1/1) - (1/3)) + ((1/5) - (1/7)) + ((1/9) - (1/11))
f(3, 2) = 2*( 0.6667 + .0571 + .0202 )
f(3, 2) = 1.48802

What's the question?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.