Get premium membership and access questions with answers, video lessons as well as revision papers.

Write an algorithm that can be used in calculating and outputting the sum of the first 35 natural numbers.

      

Write an algorithm that can be used in calculating and outputting the sum of the first 35 natural numbers.

  

Answers


Kavungya
Step 1: Initialize the variables that include:
i) Counting Variable – this variable is for tracking the number of values entered. Let it be initialized as: Count = 0
ii) Sum Variable – this is the variable on which the sum values are stored. Let it be initialized as: Sum = 0
Step 2: Reading of values. Let a value be represented by letter “X”
Step 3: Computing the sum; this process is represented as:
Sum = Sum + X
Step 4: Updating the counting variable; this is represented as:
Count = Count + 1
Step 5: Decision Point i.e. establishing whether the Count value is equal to 35
i) If NO, then go back to step 2 to read the next number
ii) If YES, go to step 6
Step 6: Output the total Sum
Kavungya answered the question on May 15, 2019 at 15:01


Next: Describe the basics of C++
Previous: Outline the guidelines used during flowcharting.

View More Computer Programming Questions and Answers | Return to Questions Index


Learn High School English on YouTube

Related Questions