Page 1 of 1

Use C language plz.

Posted: Wed Apr 27, 2022 3:10 pm
by answerhappygod
Use C language plz.
Use C Language Plz 1
Use C Language Plz 1 (188.71 KiB) Viewed 30 times
Write a program that reads in a non-negative integer n, and computes the nth Fibonacci number. The nth Fibonacci number, denoted fib(n), is defined below: 0, when n = 0 fib(n) = 1, = when n = 1 (fib(n - 1) + fib(n - 2), when n > 1 Your program should include i.a recursive sub-function that returns fib(n), and its prototype is int fib(int n); ii.the main function that reads in n, calls fib() and prints the result to the screen. Below is a sample run of your program. You may assume that the user input is always legal. Х Console program output Please input a non-negative number: 4 The 4th Fibnacci number is: 3 Press any key to continue...