183,374 views
0 votes
0 votes
Prepare an algorithm and draw a corresponding flowchart to compute the

mean value of all odd numbers between 1 and 100 inclusive.

User Redrubia
by
2.2k points

1 Answer

20 votes
20 votes

Answer:

Algorithm :

1.START

2. sum=0 ; n=1 ; length = 1

3. sum = sum + n

4. n = n + 2

5. length = length + 1

6. Repeat steps 3, 4 and 5 until n <= 99

7. mean = sum / length

8. print(mean)

Step-by-step explanation:

Sum initializes the addition of the odd numbers

n starts from 1 and increments by 2, this means every n value is a odd number

The condition n <= 99 ensures the loop isn't above range isn't above 100 ;

The length variable, counts the number of odd values

Mean is obtained by dividing the SUM by the number of odd values.

Prepare an algorithm and draw a corresponding flowchart to compute the mean value-example-1
User Groteworld
by
3.1k points