/-Check-if-the-door-is-open-or-closed

Given n doors and n persons. The doors are numbered from 1 to n and persons are given id’s numbered from 1 to n. Each door can have only two statuses ie open (1) or closed (0) . Initially all the doors have status closed. Find the final status of all the doors, when all the persons have changed the status of the doors of which they are authorized. i.e. if status open then change the status to closed and vice versa. A person with id ‘i’ is authorized to change the status of door numbered ‘j’ if ‘j’ is a multiple of ‘i’.

Primary LanguageC

-Check-if-the-door-is-open-or-closed

Given n doors and n persons. The doors are numbered from 1 to n and persons are given id’s numbered from 1 to n. Each door can have only two statuses ie open (1) or closed (0) . Initially all the doors have status closed. Find the final status of all the doors, when all the persons have changed the status of the doors of which they are authorized. i.e. if status open then change the status to closed and vice versa. A person with id ‘i’ is authorized to change the status of door numbered ‘j’ if ‘j’ is a multiple of ‘i’.