Q:

Write a Kotlin program to create an array of size 10 containing

belongs to collection: Kotlin programming Exercises

0

Write a Kotlin program to create an array of size 10 containing

0
2
4
6
8
10
12
14
16
18

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Solution:

fun main(args : Array<String>)  {  
	val x = Array(10) { i -> i * 2 }
	for(s in x){
		println(s);
	}
}

Output:

0
2
4
6
8
10
12
14
16
18

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Write a program in kotlin to print the following s... >>
<< How to get average of the given array elements in ...