0
Alternate Elements Of Array
How to print alternate elements of an array in Kotlin. for example elements of an array are (1,2,3,4,5,6,7,8,9) then the output should be (1,3,5,7,9)
2 Antworten
+ 2
Hi! in the loop, go through all the elements of the array, define the even element by the formula or not, and immediately display the result on the screen. or collect the result into a second, new array. then, display it on the screen.
+ 1
You print the even or odd index elements.