Computers and Technology

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; }

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 02:00, mayapril813
Consider the following function main: int main() { int alpha[20]; int beta[20]; int matrix[10][4]; . . } a. write the definition of the function inputarray that prompts the user to input 20 numbers and stores the numbers into alpha. b. write the definition of the function doublearray that initializes the elements of beta to two times the corresponding elements in alpha. make sure that you prevent the function from modifying the elements of alpha. c. write the definition of the function copyalphabeta that stores alpha into the first five rows of matrix and beta into the last five rows of matrix. make sure that you prevent the function from modifying the elements of alpha and beta. d. write the definition of the function printarray that prints any onedimensional array of type int. print 15 elements per line. e. write a c11 program that tests the function main and the functions discussed in parts a through d. (add additional functions, such as printing a two-dimensional array, as needed.)
Answers: 3
image
Computers and Technology, 23.06.2019 14:30, soapai
Select the correct answer. sean is a computer programmer. he has programmed an application for toddlers that plays nursery rhymes. however, a logic error has occurred in the program. which problem is a likely consequence of the error? a. the program crashes every time the user wants to play the nursery rhymes. b. the program crosses its buffer boundaries and overwrites an adjacent program. c. the program plays a different nursery rhyme than the one the user intended to play. d. the program shows different structures in its programming language code. e. the program introduces new viruses every time the user plays a nursery rhyme.
Answers: 1
image
Computers and Technology, 23.06.2019 14:30, officialrogerfp3gf2s
Select the correct answer. a company wants to use online methods to target more customers. it decides to conduct a market research by collecting the data of a few customers with their consent. they want to track data of the sites that their customers frequently visit. which software can the company? a. spyware b. bots c. adware d. trojan horse e. rootkits
Answers: 1
image
Computers and Technology, 23.06.2019 19:30, bbgirl8638
Of the following pieces of information in a document, for which would you most likely insert a mail merge field?
Answers: 3
Do you know the correct answer?
The value of π can be approximated by using the following series: the following program uses this s...

Questions in other subjects:

Konu
Mathematics, 02.11.2020 19:50
Konu
Mathematics, 02.11.2020 19:50