You are on page 1of 1

Lab#07: Open Ended Lab - I SUET/QR/114

Lab # 07

Open Ended Lab - I

Objective
Simulate a game. The game involves a number of children, and you are supposed to
read their names from any appropriate data structure. The children whose names
are on index numbered by prime numbers should be placed on the first list, and the
others on the second list. Every mth child, where m is the number of elements in the
first list is eliminated from that list. Counting goes on with the next child. Repeat this
counting m times or till the second list gets empty. Your program should output the
initial lists and the final second list.
Example. Input: Output:
John Prime [7 children]:
James s------
Ann John
George James
Amy Ann
Fanny Amy
Winston Winston
Bill Alex
Suzanna Thomas
Hannah Non-prime [6 children]:
Alex ----------
Gaby George
Thomas Fanny
Bill
Suzanna
Hannah
Thomas

Algorithm

Source Code

Results

Conclusion

CE-205: Data Structures and Algorithms Page 29

You might also like