Ask your own question, for FREE!
Computer Science 15 Online
OpenStudy (anonymous):

i need to write a geometric series in c program, its like you take a step and each new step is half the previous step and how far travelled after 5 steps?

OpenStudy (woodrow73):

I can't help with the syntax, but did you make an algorithm for it yet?

OpenStudy (rsmith6559):

Here's a recursive function that will do it: ``` /* Recursive function to calculate the distance travelled * in number of steps ( numSteps ) that start out being * ( length ) long. Each step is half the length of the * previous step. */ float doStep( int numSteps, float length ) { if( numSteps ) return( doStep( --numSteps, length / 2 ) + length ); else return( 0 ); } ```

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!