+ 2
ErrStream Error
When I enter 1,00,000 value in input this gives a error . I don't know what this means. Anyone can solve this problem https://code.sololearn.com/cr2R9U27RB2F/?ref=app
8 Answers
+ 3
Akash Agrawal
Sololearn has defined some max size for the log file because of bandwidth, log file means when you compile program then a log file generates. after generating files they show result on terminal. So your program output size is exceeding than that log file which is showing you as an error.
Did you try to run on local machine?
+ 2
AĶ¢J Yes I try after you said this code work really well in local machine but don't work in sololearn .
Thanks for solving what are real problem
+ 1
because the size of output is exceeding than the defined log size.
There is some limitations for the log size.
+ 1
Akash Agrawal
As I said there is some limitations so
Just change num - 1 to num and then tell me working or not
0
AĶ¢J so why this code work
import kotlin.math.round
fun main(args: Array<String>) {
val start = System.nanoTime()
val range = readLine()?.toInt()
if (range!=null){
(2..range).forEach{
if (checkPrime(it)){
print(it)
}
}
println()
}
else{
println("Please Input the range")
}
val end = System.nanoTime()
println("Execution Time:${(end-start)/1e9}s")
}
fun checkPrime(num:Int):Boolean{
(2..num-1).forEach{
if (num%it==0){
return false
}
}
return true
}
0
AĶ¢J if I change num-1 to num then prime number divide by itself and prime function gives nothing
0
AĶ¢J ok I will understand there is certain limation here-:
(2..100000).forEach{
println(100000%i)
}
kotlin doesn't run this code and throw a error.
0
Error: Mandatory event property not passed; violation handler dropped event
Description: Event property was declared mandatory for the said event in the schema. Incoming data did not have the mandatory event property, hence, the event was dropped.
Solution: Fix the incoming data from SDK/API to ensure the said. event property is always passed
Remove the validation for the said event from the schema.
Regards,
Peter