The value for PI can be determined by the series equation
PI=4x(1-1/3+1/5-1/7+1/9-1/11+1/13-....)
write an interactive program that asks the user how manu terms of series
equation to use in approximating PI. Then calculate and display the
approximation. Here is a sample run:
PI Approximation Program
How many terms of the series should be included?
(The more terms, the better the approximation)
=> 3
Approximation value of pi is 3.466667.
essentialc++33
0
Newbie Poster
Recommended Answers
Jump to Postwrite some code, and then ask us for help when u get stuck. read the sticky about homework.
Jump to PostApproximation value of pi is 3.466667.
Don't you mean ~3.1415 ... ??
Jump to PostI hope he does, 3.4 is a tad bit off .... hey try to do the project on your own and when you get absolutley then specify your exact problem and post some code then we can help you out :D
Jump to Postyou need to display pi when it has been approximated:
cout << "approximate value of pi is"<<pi<<endl;
andpi =4x(1-1/3+1/5-1/7-+1/9-1/11+1/13/...);
will not work becuase the compiler can not calculate the ... so to coninue you would need some sort of looped structure. Then when it has done that, …
All 15 Replies
infamous
26
Junior Poster in Training
Dani
3,986
The Queen of DaniWeb
Administrator
Featured Poster
Premium Member
BountyX
7
Posting Whiz in Training
essentialc++33
0
Newbie Poster
essentialc++33
0
Newbie Poster
BountyX
7
Posting Whiz in Training
essentialc++33
0
Newbie Poster
BountyX
7
Posting Whiz in Training
essentialc++33
0
Newbie Poster
BountyX
7
Posting Whiz in Training
essentialc++33
0
Newbie Poster
essentialc++33
0
Newbie Poster
loga88
0
Newbie Poster
beginner_199
0
Newbie Poster
raptr_dflo
48
Posting Pro
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.