Lab Assignment
Lab Assignment
Submitted BY:
Name: Kazi Abir Hasan
ID: 0242310005101213
Section: 64_L
Department of CSE
Submitted To:
Md. Ferdouse Ahmed Foysal
Lecturer
Department of CSE
#include<stdio.h>
int fibonacci(int n) {
if (n <= 0)
return 0;
else if (n == 1)
return 1;
else
return fibonacci(n - 1) + fibonacci(n - 2);
}
int main() {
int n;
printf("Enter the value of n: ");
scanf("%d", &n);
return 0;
}
Answer 02:
Last two digit for roll are 1&3;
10 mod of the sum of last digits is (1+3)%10==5.
So considering 4 as ‘n’ in problem 1, the recursion tree is
given below:
fib(4)
/ \
fib(3) fib(2)
/ \ / \
fib(2) fib(1) fib(1) fib(0)
/ \
fib(1) fib(0)