Team Emertxe
Function and Pointer
Basics
Assignment 18
Assignment 18
Assignment 18
WAP to generate negative fibonacci numbers using
Recursion.
Assignment 18
WAP to generate negative fibonacci numbers using
Recursion.
Input:
Assignment 18
WAP to generate negative fibonacci numbers using
Recursion.
Input: Read integer ‘num’
Assignment 18
WAP to generate negative fibonacci numbers using
Recursion.
Input: Read integer ‘num’
Output:
Assignment 18
WAP to generate negative fibonacci numbers using
Recursion.
Input: Read integer ‘num’
Output: Print negative fibonacci numbers upto ‘num’
Assignment 18
WAP to generate negative fibonacci numbers using
Recursion.
Input: Read integer ‘num’
Output: Print negative fibonacci numbers upto ‘num’
Note: Should not use static and global variables.
Assignment 18
Example’s:
Assignment 18
Example’s:
Input: num = -8
Output: 0, 1, -1, 2, -3, 5, -8
Assignment 18
Example’s:
Input: num = -8
Output: 0, 1, -1, 2, -3, 5, -8
0 1
Assignment 18
Example’s:
Input: num = -8
Output: 0, 1, -1, 2, -3, 5, -8
0 -1
1
0 - 1 = -1
Assignment 18
Example’s:
Input: num = -8
Output: 0, 1, -1, 2, -3, 5, -8
0 2
-1
1
0 - 1 = -1
1 - (-1) = 2
Assignment 18
Example’s:
Input: num = -8
Output: 0, 1, -1, 2, -3, 5, -8
0 -3
2
-1
1
0 - 1 = -1
1 - (-1) = 2
-1 - 2 = -3
Assignment 18
Example’s:
Input: num = -8
Output: 0, 1, -1, 2, -3, 5, -8
0 5
-3
2
-1
1
0 - 1 = -1
1 - (-1) = 2
-1 - 2 = -3
2 –(-3) = 5
Assignment 18
Example’s:
Input: num = -8
Output: 0, 1, -1, 2, -3, 5, -8
0 5
-3
2
-1
1 -8
0 - 1 = -1
1 -(-1) = 2
-1 - 2 = -3
2 -(-3) = 5
-3 - 5 = -8
Assignment 18
Example’s:
Assignment 18
Example’s:
Input: num = -8
Assignment 18
Example’s:
Input: num = -8
Output: 0, 1, -1, 2, -3, 5, -8
Assignment 18
Example’s:
Input: num = -8
Output: 0, 1, -1, 2, -3, 5, -8
Input: num = -10
Assignment 18
Example’s:
Input: num = -8
Output: 0, 1, -1, 2, -3, 5, -8
Input: num = -10
Output: 0, 1, -1, 2, -3, 5, -8
Assignment 18
Example’s:
Input: num = -8
Output: 0, 1, -1, 2, -3, 5, -8
Input: num = -10
Output: 0, 1, -1, 2, -3, 5, -8
Input: num = 21
Assignment 18
Example’s:
Input: num = -8
Output: 0, 1, -1, 2, -3, 5, -8
Input: num = -10
Output: 0, 1, -1, 2, -3, 5, -8
Input: num = 21
Output: Invalid input
Assignment 18
Example’s:
Input: num = -8
Output: 0, 1, -1, 2, -3, 5, -8
Input: num = -10
Output: 0, 1, -1, 2, -3, 5, -8
Input: num = 21
Output: Invalid input
Input: num = -21
Assignment 18
Example’s:
Input: num = -8
Output: 0, 1, -1, 2, -3, 5, -8
Input: num = -10
Output: 0, 1, -1, 2, -3, 5, -8
Input: num = 21
Output: Invalid input
Input: num = -21
Output: 0, 1, -1, 2, -3, 5, -8, 13, -21
Sample execution:-
Assignment 18
Sample execution:-
Assignment 18
Sample execution:-
Assignment 18
Sample execution:-
Assignment 18
Assignment 18
Pre-requisites:-
Assignment 18
Pre-requisites:-
Arithmetic operators
Assignment 18
Pre-requisites:-
Arithmetic operators
Recursions
Assignment 18
Pre-requisites:-
Arithmetic operators
Recursions
Objective:-
Assignment 18
Pre-requisites:-
Arithmetic operators
Recursions
Objective:-
To understand the concept of Recursive Functions.
Team Emertxe
Thank you

18_negative_fibonacci.pdf