Exercise 2

Flowchart

← Prev

Q1. Find the sum of the numbers in each set.

You are given hundred numbers divided in ten sets in the following order.

Set 1: 1-10

Set 2: 11-20

Set 3: 21-30

Set 10: 91-100

You have to draw a flowchart that will print the sum of each set.

Solution

To solve this problem we have to apply the concept of loop which was covered in exercise-1.

Algorithm in simple English

  1. Initialize count = 1 and i = 1 (PROCESS)
  2. Check if i is less than or equal to 10 (DECISION)
    if YES then perform step 3
    else STOP
  3. Set sum = 0 and j = 1 (PROCESS)
  4. Check if j is less than or equal to 10 (DECISION)
    if YES then perform step 5
    else perform step 9
  5. Add count to sum
    sum = sum + count (PROCESS)
  6. Increment count by 1
    count = count + 1 (PROCESS)
  7. Increment j by 1
    j = j + 1 (PROCESS)
  8. Go to Step 4
  9. Print sum (I/O)
  10. Increment i by 1
    i = i + 1 (PROCESS)
  11. Go to Step 2

Flowchart

← Prev

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

We use cookies to enhance user experience. By continuing to browse this site you agree to our use of cookies. More info

Got it!