40.8k views
12 votes
An algorithm to calculate average of numbers​

User Staffan
by
3.2k points

1 Answer

3 votes

Answer:

Algorithm to calculate the average of numbers is

  1. Start
  2. sum = 0, i = 1, average, count = 0
  3. if i / 2 == 0 then go to step 4, else go to on step 5
  4. sum = sum + i, count = count + 1
  5. i = i + 1
  6. if i <= 50 then go to on step 3, else go to on step 7
  7. Display “sum”
  8. average = sum/count
  9. Display “average”
  10. Stop

Step-by-step explanation:

Algorithm to calculate the average of numbers is

  1. Start
  2. sum = 0, i = 1, average, count = 0
  3. if i / 2 == 0 then go to step 4, else go to on step 5
  4. sum = sum + i, count = count + 1
  5. i = i + 1
  6. if i <= 50 then go to on step 3, else go to on step 7
  7. Display “sum”
  8. average = sum/count
  9. Display “average”
  10. Stop
User Rvphx
by
3.6k points