Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In c++ please You can compute pi using the following formula. The formula gives 3.13159 after adding the first 100 terms, and gives 3.14149 after
In c++ please
You can compute "pi" using the following formula. The formula gives 3.13159 after adding the first 100 terms, and gives 3.14149 after adding the first 100000 terms pi/4 = 1 -1/3 + 1/5 -1/7 + 1/9 - 1/11 + ... Write the recursive functions piTok to return calculate pi/4 by adding the first k elements. piTok(1) returns 1 piTok(2) returns piTok(1) - 1/3 which is the sum of 1 - 1/3 piTok(3) returns piTok(2) + 1/5 which is the sum of 1 - 1/3 + 1/5 pi Tok(4) returns piTok(3) - 1/7 which is the sum of 1 - 1/3 + 1/5 - 1/7 piTok(k) returns piTok(k-1) + kth_Element To calculate the kth_Element, you will need to find out whether it is positive or negative as well as what the denominator would be. void piTok(int k) { // YOUR CODE GOES HERE }Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started