Yesterday in compsci class we were introduced to if()/else, while(), and for() statements. In theory it all seemed like the other things we've encountered, generally easy concepts to understand and implement.
However today we were assigned to make a program based on the Leibniz formula for Pi. Basically we are to make a program where the user specifies how many iterations of the formula are to be calculated and then the program outputs the result.
The tricky part is the sequence switching from (-) to (+) and the 1/3, 1/5, 1/7, etc sequence.
Anyone think they can point me out in a good direction?
Question
Labot2001
Yesterday in compsci class we were introduced to if()/else, while(), and for() statements. In theory it all seemed like the other things we've encountered, generally easy concepts to understand and implement.
However today we were assigned to make a program based on the Leibniz formula for Pi. Basically we are to make a program where the user specifies how many iterations of the formula are to be calculated and then the program outputs the result.
The tricky part is the sequence switching from (-) to (+) and the 1/3, 1/5, 1/7, etc sequence.
Anyone think they can point me out in a good direction?
Link to comment
Share on other sites
2 answers to this question
Recommended Posts