Computer Science, asked by Arbitrage, 7 months ago

using loop in kotlin intellij print only even numbers between 1 to 100..​

Answers

Answered by allysia
1

Language:

Kotlin

Program:

fun main() {

   for (i in 2..99) {

   if(i%2==0){println(i)}

}  }

Explanation:

  • Between 1 and 100 which implies excluding 1 and 100.
  • Start a for loop from 2 to 99
  • Use conditional statement to check divisibility by 2.
Similar questions