Divisors finding

Report a typo

Using the given code and the debugger, find the smallest divisor of the number 5977 (except 1, of course).

fun isPrime(number: Int): Boolean {
    for (i in 2..(number / 2)) {
        if (number % i != 0)
            continue
        else
            return false
    }
    return true
}

fun main() {
    val result = isPrime(5977)
}
Enter a number
___

Create a free account to access the full topic