Ad
Code
Diff
  • fun fact(n: Int): Int {
        var result  = 1
        for(i in 1..n){
            result *= i
        }
        return result
    }
    • fun fact(n: Int): Int {
    • var fact = 1
    • var check = n
    • while(check > 0) {
    • fact *= check
    • check--
    • var result = 1
    • for(i in 1..n){
    • result *= i
    • }
    • return fact
    • return result
    • }