October 18th, 2012, 06:21 AM
Question need to solve about C++
Hello People this the first thread for me in this fourms I have a really hard Question about Algorthim I have to solve for the assignment so I wish to find the solve in this fourm the question is.
write an algorithm for a program that calculates the value of Z as follow:
Z = 1/1 - 1/4 - 1/16 - 1/64 - 1/256 - 1/1024
Note: you are required to use the loop structure.
So please anyone who now the answer or how to solve it to tell.
October 18th, 2012, 06:31 AM
What do you notice about the progression 1, 4, 16, 64, 256, 1024?
Do you know what the next terms will be?
Can you write a for loop to print this progression?
October 18th, 2012, 06:45 AM
I noticed that every number is divided by 4 but I dont know how how to write a loop to print print this progression could you give me a loop please :confused:
October 18th, 2012, 07:02 AM
So for example,
denominator = 1;
Then in a loop
denominator = denominator * 4;
That's all I can say without giving you the chance to post some code of your own.
The whole problem is only like 5 lines of code, and saying anymore would just give the whole game away.
October 18th, 2012, 08:35 AM
The series has a finite sum, which has an analytic answer. You should compare your sum with this.
Also, you'll get a more accurate answer from the sum if you sort the terms and add them from smallest magnitude toward largest magnitude.
[/code] are essential for python code and Makefiles!