Quizzma Latest Questions

In the following procedure, the parameter n is an integer greater than 2. Which of the following best describes the value returned by the procedure?

Anonymous

In the following procedure, the parameter n is an integer greater than 2. Which of the following best describes the value returned by the procedure?




Related Questions

Leave an answer

Leave an answer

1 Answer

  1. The procedure initially sets result to 1 and j to 2. In the REPEAT UNTIL loop, result is first assigned the sum of result and j, or 1 + 2. The value of j is then increased to 3. In each subsequent iteration of the loop, result is increased by each successive value of j (3, 4, 5, etc.) until j exceeds n. Therefore, the procedure returns the sum of the integers from 1 to n.