numbers = [7, 14, 16, 9, 24, 30]
value1 = numbers[0]
value2 = numbers[2]
value3 = numbers[4]
code = [value1,value2,value3]
OUTPUT code
numbers = [18, 15, 6, 21, 32]
length = length(numbers)
value1 = numbers[0]
value2 = numbers[length-1]
code = [value1,value2,length]
OUTPUT code
list = [22, 10, 31, 19, 8, 17]
IF list[0]>list[1] THEN
tmp = list[0]
list[0] = list[1]
list[1] = tmp
END IF
code = [list[0],list[1],list[2]]
OUTPUT code
set1 = [5, 10, 15, 20, 25, 30]
set2 = [3, 6, 9, 12, 15, 18]
code = []
FOR i FROM 0 TO 5
IF i<3 THEN
value = set1[i] + set2[i]
code.append(value)
END IF
NEXT i
OUTPUT code
numbers = [17, 28, 6, 9, 32, 8, 35]
code = []
FOR i FROM 0 TO length(numbers)-1
value = numbers[i]
IF value MOD 2 == 1 THEN
code.append(value)
END IF
NEXT i
OUTPUT code
______________________________________
Help:
The MOD operator returns the remainder
of a division:
e.g.
7 MOD 3 = 1
numbers = [3, 12, 7, 23, 14, 11, 12]
code = []
FOR i FROM 0 TO length(numbers)-2
IF numbers[i+1] > numbers[i] THEN
code.append(numbers[i+1])
END IF
NEXT i
OUTPUT code
array = [18, 12, 6, 9, 5, 34, 17]
code = []
FOR i FROM 2 TO 4
value = array[i] * i
code.append(value)
NEXT i
OUTPUT code
myList = [2,5,7,8,1,3,6,9,8]
code = []
FOR i FROM 0 TO 8 STEP 4
code.append(myList[i])
NEXT i
OUTPUT code
numbers = [7, 14, 6, 9, 24, 12]
code = []
FOR i FROM 5 TO 0 STEP -1
IF i>2 THEN
value = numbers[i]
code.append(value)
END IF
NEXT i
OUTPUT code
digits = [[7,8,9],[4,5,6],[1,2,3]]
code = []
FOR i FROM 0 TO 2
code.append(digits[i][0])
NEXT i
OUTPUT code
numbers = [[7,8,9],[4,5,6],[1,2,3]]
code = []
FOR i FROM 0 TO 2
code.append(numbers[i][i])
NEXT i
OUTPUT code
numbers = [[7,8,9],[4,5,6],[1,2,3]]
code = []
FOR i FROM 0 TO 2
value = 0
FOR j FROM 0 TO 2
value = value + numbers[i][j]
NEXT j
code.append(value)
NEXT i
OUTPUT code