Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

John the Postman became bored one night, and to break the monotony of the night shift, he carried out an experiment with a row of

John the Postman became bored one night, and to break the monotony of the night shift, he carried out an 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 even-numbered mailboxes. Next, beginning with mailbox 3, he went to every third mailbox, opening its door if it was closed and closing its door if it was opened. Then he repeated this procedure with every fourth mailbox starting at mailbox 4, then every fifth mailbox, and so on. When he finished he was surprised at the distribution of opened and closed mailboxes. Write a program to determine which mailboxes are opened and which ones are closed, and output the results neatly in a table format. Assumption: all mailboxes are initially closed

image text in transcribed

sample output format 1 opened 2 opened 3 closed 4 closed 5 opened 6 opened. 7-opened 8 closed 9 closed 10 closed 11 closed 12 closed 13 closed 14 opened 15 F closed. (BTW: results above are incorrect to demonstrate output format only)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions