Bifalgorithm post · Computer science one · Summation
How can a summation loop be generalized to sum up to a variable n?
How can a summation loop be generalized to sum up to a variable n? (Computer science one · Summation) — "Let’s revisit the example from Section 4.2.1 in which…
Ideas in this flowchart
- Generalizing the code for summing integers
- The discussion revisits the example from Section 4.2.1
- The example computes the sum 1 + 2 + · · · + 10
- The code is presented in Code Sample 28.8
- The code could be generalized beyond a particular upper limit
- The original version sums up to a particular number
- The generalized version sums up to a variable n
- The for loop is modified to use n as its upper limit