Home / Questions / Peter the postman became bored one night and, to break the monotony of the night shift, he...
Peter the postman became bored one night and, to break the monotony of the night shift, he carried out the following experiment with a row of mailboxes in the post office. These mailboxes were numbered 1 through 150, and beginning with mailbox 2, he opened the doors of all the even-numbered mailboxes, leaving the others closed. Next, beginning with mailbox 3, he went to every third mail box, opening its door if it were closed, and closing it if it were open. Then he repeated this procedure with every fourth mailbox, then every fifth mailbox, and so on. When he finished, he was surprised at the distribution of closed mailboxes. Write a program to determine which mailboxes these were.
Assignment
First write a function to initialize all mailbox doors to closed (you can use Boolean type for closed or not).
Next write a second function that will conduct what Peter did as described above.
Next write another function that will output all of the mailboxes whose doors are closed.
Next write the main function. In your main function, call all of the above three functions to find out the distribution of closed mailboxes for Peter.
Apr 02 2020 View more View Less
Draw structural formulas for each of the following compounds: a. Propanalb. 3-methyl-2-butanonec. 2,2-dimethylcyclopentanoned. 3-bromo-4-phenylbutanal
Jun 17 2021Determine the phase shift and attenuation from the input to the output for the ladder network in Figure 72.
Jul 31 2020IMXP Corp. enters into a 30-day forward exchange contract to buy 113,540,000 yen for $100,000. Which of the following statements is true concerning this transaction?a. IM...
Aug 14 2020Give the systematic name for the alkane. Draw a structural isomer of the compound, and give its name.
Jul 25 2021At benedict test,cupper ion will oxidize formaldehyde ,this will be lead to form:
May 21 2021Describe and discuss the classic argument from divine foreknowledge against human freedom. Present and evaluate the reply involving divine timelessness and one other repl...
Feb 14 2020Direct Labor and Manufacturing Overhead Budgets . The production department of Raredon Corporation has submitted the following forecast of units to be produced by quarter...
Nov 09 2017Write a summary of the video and answer the two questions below. 1) As a pre-professional Teacher, how can you implement positive education in the classroom? 2) Do you ...
Feb 14 2020Determine the final state and temperature of of water originally at after of heat is added.
May 20 2021For the following reaction, if it is balanced, the number of moles of sulphuric acid are S + → SO2 H2SO4 H20 + 2 mol 1 mol 4 mol 3 mol
May 16 2021