fun linearSearch(array: List<Int>, number: Int) {
for (i in array.indices) {
if (array[i] == number) {
println(i)
}
}
}
fun main() {
val array = listOf(8, 2, 8, 4, 5, 6, 7, 8, 9, 8)
val number = 8
println("Poszukiwana wartosc znajduje sie pod następujacymi indeksami:")
linearSearch(array, number)
}
ZnVuIGxpbmVhclNlYXJjaChhcnJheTogTGlzdDxJbnQ+LCBudW1iZXI6IEludCkgewogIGZvciAoaSBpbiBhcnJheS5pbmRpY2VzKSB7CiAgICBpZiAoYXJyYXlbaV0gPT0gbnVtYmVyKSB7CiAgICAgIHByaW50bG4oaSkKICAgIH0KICB9Cn0KCmZ1biBtYWluKCkgewogIHZhbCBhcnJheSA9IGxpc3RPZig4LCAyLCA4LCA0LCA1LCA2LCA3LCA4LCA5LCA4KQogIHZhbCBudW1iZXIgPSA4CgogIHByaW50bG4oIlBvc3p1a2l3YW5hIHdhcnRvc2Mgem5hamR1amUgc2llIHBvZCBuYXN0xJlwdWphY3ltaSBpbmRla3NhbWk6IikKICBsaW5lYXJTZWFyY2goYXJyYXksIG51bWJlcikKfQ==