SlideShare a Scribd company logo
1 of 42
Download to read offline
Team Emertxe
Function and Pointer
Basics
Assignment 17
Assignment 17
Assignment 17
WAP to generate positive fibonacci numbers using
Recursion.
Assignment 17
WAP to generate positive fibonacci numbers using
Recursion.
Input:
Assignment 17
WAP to generate positive fibonacci numbers using
Recursion.
Input: Read integer ‘num’
Assignment 17
WAP to generate positive fibonacci numbers using
Recursion.
Input: Read integer ‘num’
Output:
Assignment 17
WAP to generate positive fibonacci numbers using
Recursion.
Input: Read integer ‘num’
Output: Print positive fibonacci numbers upto ‘num’
Assignment 17
WAP to generate positive fibonacci numbers using
Recursion.
Input: Read integer ‘num’
Output: Print positive fibonacci numbers upto ‘num’
Note: Should not use static and global variables.
Assignment 17
Example’s:
Assignment 17
Example’s:
Input: num = 8
Output: 0, 1, 1, 2, 3, 5, 8
Assignment 17
Example’s:
Input: num = 8
Output: 0, 1, 1, 2, 3, 5, 8
0 1
Assignment 17
Example’s:
Input: num = 8
Output: 0, 1, 1, 2, 3, 5, 8
0 1
1
0 + 1 = 1
Assignment 17
Example’s:
Input: num = 8
Output: 0, 1, 1, 2, 3, 5, 8
0 2
1
1
0 + 1 = 1
1 + 1 = 2
Assignment 17
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 17
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 17
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 17
Example’s:
Assignment 17
Example’s:
Input:
Assignment 17
Example’s:
Input: num = 5
Assignment 17
Example’s:
Input: num = 5
Output:
Assignment 17
Example’s:
Input: num = 5
Output: 0, 1, 1, 2, 3, 5
Assignment 17
Example’s:
Input: num = 5
Output: 0, 1, 1, 2, 3, 5
Input:
Assignment 17
Example’s:
Input: num = 5
Output: 0, 1, 1, 2, 3, 5
Input: num = 15
Assignment 17
Example’s:
Input: num = 5
Output: 0, 1, 1, 2, 3, 5
Input: num = 15
Output:
Assignment 17
Example’s:
Input: num = 5
Output: 0, 1, 1, 2, 3, 5
Input: num = 15
Output: 0, 1, 1, 2, 3, 5, 8, 13
Assignment 17
Example’s:
Input: num = 5
Output: 0, 1, 1, 2, 3, 5
Input: num = 15
Output: 0, 1, 1, 2, 3, 5, 8, 13
Input:
Assignment 17
Example’s:
Input: num = 5
Output: 0, 1, 1, 2, 3, 5
Input: num = 15
Output: 0, 1, 1, 2, 3, 5, 8, 13
Input: num = -7
Assignment 17
Example’s:
Input: num = 5
Output: 0, 1, 1, 2, 3, 5
Input: num = 15
Output: 0, 1, 1, 2, 3, 5, 8, 13
Input: num = -7
Output:
Assignment 17
Example’s:
Input: num = 5
Output: 0, 1, 1, 2, 3, 5
Input: num = 15
Output: 0, 1, 1, 2, 3, 5, 8, 13
Input: num = -7
Output: Invalid input
Assignment 17
Example’s:
Input: num = 5
Output: 0, 1, 1, 2, 3, 5
Input: num = 15
Output: 0, 1, 1, 2, 3, 5, 8, 13
Input: num = -7
Output: Invalid input
Input: num = 1
Assignment 17
Example’s:
Input: num = 5
Output: 0, 1, 1, 2, 3, 5
Input: num = 15
Output: 0, 1, 1, 2, 3, 5, 8, 13
Input: num = -7
Output: Invalid input
Input: num = 1
Output: 0, 1, 1
Sample execution:-
Assignment 17
Sample execution:-
Assignment 17
Sample execution:-
Assignment 17
Sample execution:-
Assignment 17
Assignment 17
Pre-requisites:-
Assignment 17
Pre-requisites:-
Arithmetic operators
Assignment 17
Pre-requisites:-
Arithmetic operators
Recursions
Assignment 17
Pre-requisites:-
Arithmetic operators
Recursions
Objective:-
Assignment 17
Pre-requisites:-
Arithmetic operators
Recursions
Objective:-
To understand the concept of Recursive Functions.
Team Emertxe
Thank you

More Related Content

Similar to 17_positive_fibonacci.pdf

02 Control Structures - Loops & Conditions
02 Control Structures - Loops & Conditions02 Control Structures - Loops & Conditions
02 Control Structures - Loops & ConditionsEbad ullah Qureshi
 
50_coding_challengesfffffffffffffffffffffffffffffffffffffffffffffffffffffffff...
50_coding_challengesfffffffffffffffffffffffffffffffffffffffffffffffffffffffff...50_coding_challengesfffffffffffffffffffffffffffffffffffffffffffffffffffffffff...
50_coding_challengesfffffffffffffffffffffffffffffffffffffffffffffffffffffffff...SanthoshKumarChandra7
 
C_Lab Manual_Part A.docx
C_Lab Manual_Part A.docxC_Lab Manual_Part A.docx
C_Lab Manual_Part A.docxPandiya Rajan
 
Programming in C Lab
Programming in C LabProgramming in C Lab
Programming in C LabNeil Mathew
 

Similar to 17_positive_fibonacci.pdf (20)

07_circular_left_shift.pdf
07_circular_left_shift.pdf07_circular_left_shift.pdf
07_circular_left_shift.pdf
 
16_factorial.pdf
16_factorial.pdf16_factorial.pdf
16_factorial.pdf
 
01 odd even
01 odd even01 odd even
01 odd even
 
01_odd_even.pdf
01_odd_even.pdf01_odd_even.pdf
01_odd_even.pdf
 
04_toggle_n_bits_from_pos.pdf
04_toggle_n_bits_from_pos.pdf04_toggle_n_bits_from_pos.pdf
04_toggle_n_bits_from_pos.pdf
 
algorithm
algorithmalgorithm
algorithm
 
04_perfect_number.pdf
04_perfect_number.pdf04_perfect_number.pdf
04_perfect_number.pdf
 
06_x_pattern.pdf
06_x_pattern.pdf06_x_pattern.pdf
06_x_pattern.pdf
 
03_negative_fibonacci.pdf
03_negative_fibonacci.pdf03_negative_fibonacci.pdf
03_negative_fibonacci.pdf
 
02_positive_fibonacci.pdf
02_positive_fibonacci.pdf02_positive_fibonacci.pdf
02_positive_fibonacci.pdf
 
02 Control Structures - Loops & Conditions
02 Control Structures - Loops & Conditions02 Control Structures - Loops & Conditions
02 Control Structures - Loops & Conditions
 
50_coding_challengesfffffffffffffffffffffffffffffffffffffffffffffffffffffffff...
50_coding_challengesfffffffffffffffffffffffffffffffffffffffffffffffffffffffff...50_coding_challengesfffffffffffffffffffffffffffffffffffffffffffffffffffffffff...
50_coding_challengesfffffffffffffffffffffffffffffffffffffffffffffffffffffffff...
 
Chapter 7 rohith
Chapter 7 rohithChapter 7 rohith
Chapter 7 rohith
 
Pa1 flow chart
Pa1 flow chartPa1 flow chart
Pa1 flow chart
 
19_sorted_order.pdf
19_sorted_order.pdf19_sorted_order.pdf
19_sorted_order.pdf
 
06_replace_n_bits_pos.pdf
06_replace_n_bits_pos.pdf06_replace_n_bits_pos.pdf
06_replace_n_bits_pos.pdf
 
C_Lab Manual_Part A.docx
C_Lab Manual_Part A.docxC_Lab Manual_Part A.docx
C_Lab Manual_Part A.docx
 
Lecture 7.pptx
Lecture 7.pptxLecture 7.pptx
Lecture 7.pptx
 
12_prime.pdf
12_prime.pdf12_prime.pdf
12_prime.pdf
 
Programming in C Lab
Programming in C LabProgramming in C Lab
Programming in C Lab
 

More from Emertxe Information Technologies Pvt Ltd

More from Emertxe Information Technologies Pvt Ltd (20)

premium post (1).pdf
premium post (1).pdfpremium post (1).pdf
premium post (1).pdf
 
Career Transition (1).pdf
Career Transition (1).pdfCareer Transition (1).pdf
Career Transition (1).pdf
 
10_isxdigit.pdf
10_isxdigit.pdf10_isxdigit.pdf
10_isxdigit.pdf
 
01_student_record.pdf
01_student_record.pdf01_student_record.pdf
01_student_record.pdf
 
02_swap.pdf
02_swap.pdf02_swap.pdf
02_swap.pdf
 
01_sizeof.pdf
01_sizeof.pdf01_sizeof.pdf
01_sizeof.pdf
 
07_product_matrix.pdf
07_product_matrix.pdf07_product_matrix.pdf
07_product_matrix.pdf
 
06_sort_names.pdf
06_sort_names.pdf06_sort_names.pdf
06_sort_names.pdf
 
05_fragments.pdf
05_fragments.pdf05_fragments.pdf
05_fragments.pdf
 
04_magic_square.pdf
04_magic_square.pdf04_magic_square.pdf
04_magic_square.pdf
 
03_endianess.pdf
03_endianess.pdf03_endianess.pdf
03_endianess.pdf
 
02_variance.pdf
02_variance.pdf02_variance.pdf
02_variance.pdf
 
01_memory_manager.pdf
01_memory_manager.pdf01_memory_manager.pdf
01_memory_manager.pdf
 
09_nrps.pdf
09_nrps.pdf09_nrps.pdf
09_nrps.pdf
 
11_pangram.pdf
11_pangram.pdf11_pangram.pdf
11_pangram.pdf
 
10_combinations.pdf
10_combinations.pdf10_combinations.pdf
10_combinations.pdf
 
08_squeeze.pdf
08_squeeze.pdf08_squeeze.pdf
08_squeeze.pdf
 
07_strtok.pdf
07_strtok.pdf07_strtok.pdf
07_strtok.pdf
 
06_reverserec.pdf
06_reverserec.pdf06_reverserec.pdf
06_reverserec.pdf
 
05_reverseiter.pdf
05_reverseiter.pdf05_reverseiter.pdf
05_reverseiter.pdf
 

Recently uploaded

How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdfssuserdda66b
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 

Recently uploaded (20)

How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 

17_positive_fibonacci.pdf