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

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 

Recently uploaded (20)

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 

17_positive_fibonacci.pdf