FOR I := 1 TO UINT_TO_INT(ArrayLength) DO
TempArray := InputArray;
END_FOR
IF SortAscBtn THEN
FOR I := 1 TO UINT_TO_INT(ArrayLength) - 1 DO
FOR J := I + 1 TO UINT_TO_INT(ArrayLength) DO
IF TempArray > TempArray[j] THEN
Temp := TempArray;
TempArray := TempArray[j];
TempArray[j] := Temp;
END_IF
END_FOR
END_FOR
FOR I := 1 TO UINT_TO_INT(ArrayLength) DO
SortedAscArray[I] := TempArray[I];
END_FOR
END_IF
IF SortDescBtn THEN
FOR I := 1 TO UINT_TO_INT(ArrayLength) - 1 DO
FOR J := I + 1 TO UINT_TO_INT(ArrayLength) DO
IF TempArray[I] < TempArray[J] THEN
Temp := TempArray[I];
TempArray[I] := TempArray[J];
TempArray[J] := Temp;
END_IF
END_FOR
END_FOR
FOR I := 1 TO UINT_TO_INT(ArrayLength) DO
SortedDescArray[I] := TempArray[I];
END_FOR
END_IF
IF MaxBtn THEN
MaxValue := InputArray[1];
FOR I := 2 TO UINT_TO_INT(ArrayLength) DO
IF InputArray > MaxValue THEN
MaxValue := InputArray;
END_IF
END_FOR
END_IF
IF MinBtn THEN
MinValue := InputArray[1];
FOR I := 2 TO UINT_TO_INT(ArrayLength) DO
IF InputArray < MinValue THEN
MinValue := InputArray;
END_IF
END_FOR
END_IF
IF AvgBtn THEN
Sum := 0;
FOR I := 1 TO UINT_TO_INT(ArrayLength) DO
Sum := Sum + InputArray;
END_FOR
AvgValue := Sum / UINT_TO_INT(ArrayLength);
END_IF
IF MedianBtn THEN
FOR I := 1 TO UINT_TO_INT(ArrayLength)-1 DO
FOR J := I + 1 TO UINT_TO_INT(ArrayLength) DO
IF TempArray[I] > TempArray[J] THEN
Temp := TempArray[I];
TempArray[I] := TempArray[J];
TempArray[J] := Temp;
END_IF
END_FOR
END_FOR
IF UINT_TO_INT(ArrayLength) MOD 2 = 0 THEN
MedianValue := (TempArray[UINT_TO_INT(ArrayLength) / 2] + TempArray[UINT_TO_INT(ArrayLength) / 2 + 1]) / 2;
ELSE
MedianValue := TempArray[UINT_TO_INT(ArrayLength) / 2 + 1];
END_IF
END_IF 3