INTRODUCTION TO ALGORITHMS AND PROGRAMMING
Homework2 Questions
What floor are they?
Mr. Arbi Cela works in National Post Services. He distributes mails to the people. Sometimes he goes to apartments buildings and has to find out the floor number from the apartment number. Write a program that will find out the floor number from the given data.
Input Specifications: You will be given 3 integer numbers
? n: the number of apartments in this building
? m: the number of apartments in every floor
? k: starting floor number for the apartments
where 0 <= n <= 50, 1 <= m <= 10, 3 <= k <= 5. Then the following line, you will be given n space separated apartment numbers which are between 1 and 1000.
Output Specifications: show n spaceseparated integers: the floor numbers for every apartment given.
Sample Input
4 6 3
32 3 22 17
Sample Output:
8 3 6 5
I need help in C++ 
+3  leo interisti · January 16, 2015 
Post a Reply 
Replies 
Oldest Newest Rating 
0  mag magz · January 30, 2015 
+1 
Matt Belle
· January 30, 2015
the floor number = (the apartment number / m) + k

+3 
H. P. Lovecraft
· January 25, 2015
No one is going to do your homework for you.

 1