0

Kotlin

A
Alfredo Neto

Desafio em kotlin:

Preenchimento de Vetor I

Código:


fun main(args: Array<String>) {


  val v = readLine()!!.toInt()

  val a = IntArray(10).toMutableList()


  for (  renge and merge   ) { a[i] = a[i-1] * 2 }

  for (   renge and merge  ) { println("N[$k] = ${a[k]}") }

}


Por favor peço ajuda neste desafio em kotlin Mostre-me por favor o código correto pra verificar meu erro por favor boa noite deus os abençoe abraço:


Erro:


88test.kt:6:20: error: expecting 'in' for ( renge and merge ) { a[i] = a[i-1] * 2 } ^ 88test.kt:6:23: error: expecting ')' for ( renge and merge ) { a[i] = a[i-1] * 2 } ^ 88test.kt:6:34: error: unexpected tokens (use ';' to separate expressions on the same line) for ( renge and merge ) { a[i] = a[i-1] * 2 } ^ 88test.kt:7:21: error: expecting 'in' for ( renge and merge ) { println("N[$k] = ${a[k]}") } ^ 88test.kt:7:24: error: expecting ')' for ( renge and merge ) { println("N[$k] = ${a[k]}") } ^ 88test.kt:7:34: error: unexpected tokens (use ';' to separate expressions on the same line) for ( renge and merge ) { println("N[$k] = ${a[k]}") } ^ 88test.kt:6:24: error: unresolved reference: merge for ( renge and merge ) { a[i] = a[i-1] * 2 } ^ 88test.kt:6:40: error: unresolved reference: i for ( renge and merge ) { a[i] = a[i-1] * 2 } ^ 88test.kt:6:47: error: unresolved reference: i for ( renge and merge ) { a[i] = a[i-1] * 2 } ^ 88test.kt:7:25: error: unresolved reference: merge for ( renge and merge ) { println("N[$k] = ${a[k]}") } ^ 88test.kt:7:50: error: unresolved reference: k for ( renge and merge ) { println("N[$k] = ${a[k]}") } ^ 88test.kt:7:59: error: unresolved reference: k for ( renge and merge ) { println("N[$k] = ${a[k]}") } ^

0
0

Comentários (1)

0
K

Kauê Kuhn

03/07/2021 19:51

 for (   renge and merge  ) { println("N[$k] = ${a[k]}") }


Talvez falte um ; depois do “)

alfredo gelk neto

Brasil