Highlights
Problem 1
A school has 100 lockers (denoted L1 - L100) and 100 students (denoted S1 - S100). All lockers are closed on the first day of school.
Students can enter the locker room from the main entrance or back door.
The first student denoted S1 enters the locker room from the main entrance, starts from the 1st locker and opens every locker from 1st to 100th.
Then the second student S2 enters from the back door, starts from 2nd locker from the back (i.e. from This study resource was
shared via CourseHero.com
99th locker denoted L99), and closes every 2nd locker from the back: i.e. closes L99, L97, L95, … The third student S3 enters from the main entrance, stars from L3 (the third locker) and changes every 3rd locker (closes it if it was open, and opens it if it was closed), i.e. changes L3, L6, L9,... The fourth student S4 starts from 4th locker from the back (i.e. L97) and changes every 4th locker from the back. I.e. changes L97, L93, L89, …
The fifth student S5 starts from L5 and changes every 5th locker, i.e. changes L5, L10, L15, … The sixth student S6 stars from L95 and changes every 6th locker from the back, i.e. changes L95, L89, L83, …
After all the students have passed through the building and changed the lockers, which lockers are still open?
Main Requirements:
1. Write a program in C to find your answer and display all open locker numbers separated by coma and exactly one space (see Demo Run below).
2. Your program should work for any number of lockers/students.
You must define number of lockers and students using as:
#define MAX_LOCKERS 100
#define MAX_STUDENTS 100
And your program must use these defined values. I.e. your program must work correctly when you change MAX_LOCKERS or MAX_STUDENTS values
3. You need to use array of Booleans lockers[MAX_LOCKERS]. See stdbool.h In the Boolean array lockers[i] the value “true” means the locker is open.
Initially, all lockers are closed. You should have: bool lockers[MAX_LOCKERS] = {false};
This Computer Science Assignment has been solved by our Computer Science Experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.
Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.
© Copyright 2026 My Uni Papers – Student Hustle Made Hassle Free. All rights reserved.