package comp1110.exam;
* COMP1110 Final Exam, Question 1ii
public class Q1Fib {
Copyright By PowCoder代写 加微信 powcoder
* This function takes a positive integer, n, and returns the corresponding Fibonacci
* number, fib(N), where
* fib(0) = 0,
* fib(1) = 1, and
* fib(N) = fib(N-1) + fib(N-2) for all N > 1.
* for example:
* if n = 1 the result will be 1, and
* if n = 3 the result will be 2 because 2 = 1 + 1, and
* if n = 5 the result will be 5 because 5 = 3 + 2
public static int fib(int n) {
return -1; // FIXME Question 1ii: complete this function
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com