Write code that loops through the array userVals. Each iteration: If userVals[i] is less than 10, put userVals[i] to output, and then put "_" to output. Else, assign userVals[i] with userVals[i] plus 2. in Coral Language
Here is the question:
Write code that loops through the array userVals. Each iteration: If userVals[i] is less than 10, put userVals[i] to output, and then put "_" to output. Else, assign userVals[i] with userVals[i] plus 2.
in Coral Language, I cannot get the 4th and 5th elements to "plus 2"

Solution with detail explanation using comments:-
// consider array of 6 integers
integer array(6) userVals
integer i
// add values to array
for i = 0; i < userVals.size; i = i + 1
userVals[i] = i * 3
// iterate through array
for i = 0; i < userVals.size; i = i + 1
if userVals[i] < 10
//for value less than 10
Put userVals[i] to output
Put "_" to output
else
// value not less
userVals[i] = userVals[i] + 2
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images









