Course Programming Logic
Text Interpretation
Many programmers who start solving programming exercises have difficulty interpreting and understanding what the statement of the exercise is asking. The next exercises will test this ability.
Interpreting the statement
When reading the text of an exercise, separate the most relevant information. For example, let's consider the exercise Million Dollar Prize:

Figure 1
In red we have the description of the task requested in the exercise and in green, we have the description of the input (a
After understanding what the exercise is asking you can start thinking of a solution. One tip is to separate your program into multiple parts:
- Data Input: your program should read the described input and store it in the corresponding variables;
- Data Processing: your program should process the data read as described in the exercise
- Program Output: your program should print the correct output as requested in the exercise.
By separating your program into multiple parts it will be easier to organize and implement each part. Still considering the exercise Million Dollar Prize a possible implementation would be. 1:
- read the value
and store the next numbers in an array; - Go through each element
of the array and accumulate the sum of the elements in a variable, if that sum is greater than or equal to 1,000,000 you have found the answer, store the value of the current in a variable.