You are on page 1of 2

A program will: • input 50 unique integer values • output the largest value • output the average of the

values excluding the largest value. Draw a program flowchart to represent the algorithm. Variable
declarations are not required.

WITHOUT ARRAY

Count=1

Input num

Max=num

Total = num

while ( count <=49)

input num

count=count+1

total= total+num

if(num>max) then

max=num

endif

do while

avg=(total-max)/49

output avg
ROCEDURE BubbleSort()

DECLARE Temp : STRING

DECLARE NoSwaps : BOOLEAN

DECLARE Boundary, J : INTEGER

Boundary ← 999

REPEAT

NoSwaps ← TRUE

FOR J ← 1 TO Boundary

IF Contact[J] > Contact[J+1]

THEN

Temp ← Contact[J]

Contact[J] ← Contact[J+1]

Contact[J+1] ← Temp

NoSwaps ← FALSE

ENDIF

ENDFOR

Boundary ← Boundary - 1

UNTIL NoSwaps = TRUE

ENDPROCEDURE

You might also like