The roots of equation

Report a typo

Given are numbers a,b,c,da, b, c, d. Output in ascending order all the integers between 00 and 10001000 (inclusively) that are the roots of the equation ax3+bx2+cx+d=0a \cdot x^3 + b \cdot x^2 + c \cdot x + d = 0. The roots of a cubic equation are the values of the variable that satisfy the equation.

If a specified interval does not contain any roots of the equation, do not output anything.

Hint: You can just iterate over x from 0 to 1000 and check the value of the expression.

Sample Input 1:

-1
1
-1
1

Sample Output 1:

1

Sample Input 2:

0
1
-6
5

Sample Output 2:

1
5

Sample Input 3:

1
1
1
1

Sample Output 3:

Write a program in Kotlin
fun main() {
// put your code here
}
___

Create a free account to access the full topic