Arguments into factorial

Report a typo

We are writing an application that should be able to read command-line arguments and calculate the factorial of a number.
Your task is to implement the getArgs() method, which takes the args array as a parameter and returns the resulting integer from the arguments.

Sample Input 1:

--num 10

Sample Output 1:

The factorial of 10 is: 3628800
Write a program in Kotlin
import kotlinx.cli.*

fun getArgs(args: Array<String>): Int {
// make your code here
return num
}

fun factorial(n: Int): Long {
return if (n == 1) n.toLong() else n * factorial(n - 1)
}
___

Create a free account to access the full topic