Generation

generate functionSat, 12 Nov 2022

calculate the first 50 fibonacci number's sum

def sumFibonacci(size: Int): Long { var first = 0L var second = 1L var sum = 0L var count = 0 while (count < size) { sum += second val temp = first + second first = second second = temp count += 1 } return sum }

Want to kickstart your project?Use the new AI Studio to create your code