3
I have to solve a problem with the following statement:
The houses on that street
Context
A computer programmer lives on a street with houses only on one side. The houses on this street are numbered sequentially starting from number 1 (one). Every day the programmer leaves home to walk and, randomly choosing a direction, right or left, goes to the end of the street and back. One day she decided to add up the numbers of the houses she passed on the way to and from, excluding her own home. The other day she took the other direction and also added the numbers of the houses she passed, on the way and on the way back, excluding the house itself. To your surprise the sums were equal.
Description
Write a program that prints pairs of integer and positive numbers, the first representing the number of a house and the second representing the number of houses on the street, such that the property observed by the programmer occurs. For example, the first pair of numbers with this property is 6 and 8. That is, if the programmer lives in house 6 on a street that has 8 sequentially numbered houses, then the sum of the houses on the way back and forth to the end of the street will be the same in both directions. The second pair with this property will be 35 and 49.
I have not yet noticed the "math" and/or relationship behind these street houses. For example: the first pair is 6 and 8, the second is 35 and 49. What is the relationship between them? Could someone explain to me or create a simple model in pseudocode so that I have an idea?
I think the question is clearer now ;)
– Lucas
Curious question. I think the question is very objective, it does not ask for an opinion, it is clear what you are asking, it is not so wide, it seems to me to be part of our focus and it is certainly not duplicated. Because I still think it’s bad? Is it because the OP has done nothing and wants it done? I don’t even know if it is. But if it is, it’s a matter of negative and not close.
– Maniero
I don’t want anything ready. I just said I didn’t understand the problem command, so I’m not able to do it in code.
– Lucas
I edited the question including the main part of the statement here on the website. So it is easier to understand than you are talking.
– bfavaretto
Much better that way, thank you!
– Lucas
@Lucas took the liberty of changing his question a little more, because the tag
c
it didn’t seem relevant to her. I also traded "portugol" for "pseudocode", not everyone knows what is portugol, I think you will have more chances if you stay like this, however if you prefer can undo the changes– Math
It’s just fine. Thank you!
– Lucas
You speak in Portugol but used the tag of C. This is not clear what you need. People think it’s unclear what you want. Could you give more information than you want or try to explain better what you need? I even understood. Some people might think that you haven’t tried anything before posting something here and want it all done. If it’s not that, you could post what you understood of the statement, what you’ve managed to do even if wrong?
– Maniero
Sorry anything, it’s the first time I ask a question here. Well, I didn’t do anything precisely because I didn’t understand what to do. I have not yet noticed the "math" and/or relationship behind these street houses. For example: the first pair is 6 and 8, the second is 35 and 49. What is the relationship between them? I don’t understand.
– Lucas
Well, the assistance to improve the question is great! I just don’t know if the title needs the "in C" c/c @NULL
– brasofilo
@brasofilo state of "affection" taking care of the people, rsrs
– Math