15,039,149 members
See more:
```The exam employee tries to distribute the students evenly among the examination halls. If she knows that the number of students varies between
Between 500 and 1000 and that:
01-If the student is divided into two halls, one student will be left without a room
2- If the student is divided into three halls, one student will remain without a hall
3- If the student is divided into four halls, one student remains without a room
4- If the student is divided into five halls, one student will be left without a hall
5- If the student is divided into six halls, one student will be left without a room
6- If the student is divided into seven halls, no student will remain without a hall
Write a program that allows you to know the actual number of students```

What I have tried:

`I wrote the multiples of number 7`
Posted
Updated 22-Nov-20 6:47am
Rick York 22-Nov-20 4:48am

BillWoodruff 22-Nov-20 10:21am

what is the difference between halls and rooms ?

## Solution 1

It's basically saying "solve for X where it fulfils all these equations":
```X >= 500
X <= 1000
X % 2 = 1
X % 3 = 1
...```
And asking you to write a program that determines all the possible numbers that fulfil the criteria.

So start by thinking about how you would do it manually:
1) Eliminate all even numbers between 500 and 1000 inclusive.
2) Eliminate all numbers that are divisible by three or which leave a remainder of tw0.
...

And then think about how you would code that: a loop that looks at all numbers in the range and checks if they match all criteria.
It's not difficult, but if you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
v2
BillWoodruff 22-Nov-20 9:15am

assuming even numbers have been filtered out ...

X % 3 = 1 ... should be: x % 3 == 2 ?
OriginalGriff 22-Nov-20 9:57am

"2- If the student is divided into three halls, one student will remain without a hall"
So if no students or two students are left over, that's a fail.
BillWoodruff 22-Nov-20 10:11am

hi, my take was that after eliminating the evens ... then the case of mod remainder #1 should never occur. but, numbers like #17 with mod #3 remainder #2 will occur.

i would consider enumerating the range filtering by mod #7 == #0 first to reduce the sample size as much as possible. however, i think you might know there is some interesting debate about the speed of 'mod:
https://cc.davelozinski.com/c-sharp/use-the-modulus-operator-or-alternative

https://stackoverflow.com/questions/56711861/c-sharp-strange-modulo-speed-behavior
BillWoodruff 22-Nov-20 10:17am

"So if no students or two students are left over, that's a fail." if no students are left over ... that's a pass :)
Malek Alshorbaji 22-Nov-20 12:35pm

All halls = one but the seventh equals 0
BillWoodruff 22-Nov-20 22:14pm

I do not understand what this means.
OriginalGriff 23-Nov-20 3:13am

"The number is divisible by seven" :laugh:
BillWoodruff 23-Nov-20 3:55am

I thought this was an esoteric comment on kundalini power.
OriginalGriff 23-Nov-20 4:21am

I think he's stuck in Muladhara, and even that isn't aligned ... :D
BillWoodruff 23-Nov-20 5:08am

impressive !
BillWoodruff 22-Nov-20 10:24am

I wonder if this assignment is fully described here because of the use of both "hall" and "room" :)
OriginalGriff 22-Nov-20 10:33am

They've got to use the halls as well - it's standing room only in the rooms already!
Malek Alshorbaji 22-Nov-20 12:33pm

only hall