Polynomial

Report a typo

Imagine you have three functions that calculate the value of a polynomial of varying degrees.

fun polynom(x: Int, c: Int) = c
fun polynom(x: Int, c: Int, b: Int) = b * x + c
fun polynom(x: Int, c: Int, b: Int, a: Int) = a * x * x + b * x + c

Create a function called polynomial that can replace all these functions.

Write a program in Kotlin
fun polynomial(x: Int, c: Int, b: Int, a: Int): Int {
// TODO
}
___

Create a free account to access the full topic