program bubblesort; declare A[10], i, j, n, tmp; { read in list of numbers until a -1 is encountered } i := 0; read n; if n /= -1 then do A[i] := n; read n; i := (i + 1); until n = -1; end if; n := i; { sort the numbers in ascending order } i := 0; while i < n do j := (i + 1); while j < n do if A[i] > A[j] then tmp := A[i]; A[i] := A[j]; A[j] := tmp; end if; j := (j + 1); end while; i := (i + 1); end while; { print the sorted list of numbers } i := 0; while i < n do print A[i]; i := (i + 1); end while; end program;