subject

The value of π can be approximated by using the following series: the following program uses this series to find the approximate value of π. however, the statements are in the incorrect order, and there is also a bug in this program. rearrange the statements and also find and remove the bug so that this program can be used to approximate π. #include #include using namespace std; int main () { double pi = 0; long i; long n; cin > > n; cout < < "enter the value of n: "; cout < < endl; if (i % 2 == 0) pi = pi + (1 / (2 * i + 1)); else pi = pi ? (1 / (2 * i + 1)); for (i = 0; i < n; i++) { pi = 0; pi = 4 * pi; } cout < < endl < < "pi = " < < pi < < endl; return 0; }

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 09:30
Which of the following tasks is an audio technician most likely to perform while working on a nature documentary? (select all that apply). eliminating potentially distracting background noise adding sound effects making sure the lighting is adequate for a particular scene changing the narration to better match the mood of the documentary
Answers: 3
question
Computers and Technology, 23.06.2019 17:00
1. which of the following is not an example of an objective question? a. multiple choice. b. essay. c. true/false. d. matching 2. why is it important to recognize the key word in the essay question? a. it will provide the answer to the essay. b. it will show you a friend's answer. c. it will provide you time to look for the answer. d. it will guide you on which kind of answer is required.
Answers: 1
question
Computers and Technology, 25.06.2019 04:00
What was the name of the first computer (machine) language?
Answers: 2
question
Computers and Technology, 25.06.2019 05:00
Carmina works at a fast-food restaurant. during the slow afternoon hours, carmina always find projects to keep her busy, like washing all the trays or deep-cleaning the drive-thru area. what workplace habit does carmina show by doing this? efficiency initiative interpersonal skills problem solving
Answers: 1
You know the right answer?
The value of π can be approximated by using the following series: the following program uses this s...
Questions
question
Mathematics, 08.10.2021 01:00
question
Mathematics, 08.10.2021 01:00
Questions on the website: 13722359