SlideShare a Scribd company logo
1 of 1
Download to read offline
The Fibonacci numbers are defined by the series 0, 1, 1, 2, 3, 5, 8 ,13, ... Write a program that
implements the Fibonacci series. Implement a program that prompts the user for an integer n and
prints the nth Fibonacci number, using the following algorithm. First, Take care of negative
numbers that are not defined by this series by printing an appropriate message. Next, take care of
the initial conditions: fib1 = 1 fib2 = 1 fnew = fib1 + fib2 After that, compute an updated value of
fnew, fib1, and fib2, per loop iteration. Repeat an appropriate number of times. Print the result as
in the sample runs, below.
using bython

More Related Content

More from hershbudhia1

aSuppose that we identify 145 women 50 to 54 years of age .pdf
aSuppose that we identify 145 women 50 to 54 years of age .pdfaSuppose that we identify 145 women 50 to 54 years of age .pdf
aSuppose that we identify 145 women 50 to 54 years of age .pdfhershbudhia1
 
Asthma is a common respiratory pathology How do you think t.pdf
Asthma is a common respiratory pathology How do you think t.pdfAsthma is a common respiratory pathology How do you think t.pdf
Asthma is a common respiratory pathology How do you think t.pdfhershbudhia1
 
Assume you are given a pointer to the root node of a complet.pdf
Assume you are given a pointer to the root node of a complet.pdfAssume you are given a pointer to the root node of a complet.pdf
Assume you are given a pointer to the root node of a complet.pdfhershbudhia1
 
Assume you have two lists named list1 and list2 that are of .pdf
Assume you have two lists named list1 and list2 that are of .pdfAssume you have two lists named list1 and list2 that are of .pdf
Assume you have two lists named list1 and list2 that are of .pdfhershbudhia1
 
Assuming a parent isotope with a halflife 45 billion year.pdf
Assuming a parent isotope with a halflife 45 billion year.pdfAssuming a parent isotope with a halflife 45 billion year.pdf
Assuming a parent isotope with a halflife 45 billion year.pdfhershbudhia1
 
Assume that you have a class that has an integer pointer as .pdf
Assume that you have a class that has an integer pointer as .pdfAssume that you have a class that has an integer pointer as .pdf
Assume that you have a class that has an integer pointer as .pdfhershbudhia1
 
Assume there are no taxes or risk of bankruptcy The assets .pdf
Assume there are no taxes or risk of bankruptcy The assets .pdfAssume there are no taxes or risk of bankruptcy The assets .pdf
Assume there are no taxes or risk of bankruptcy The assets .pdfhershbudhia1
 
The figure below describes the process of crossing over in .pdf
The figure below describes the process of crossing over in .pdfThe figure below describes the process of crossing over in .pdf
The figure below describes the process of crossing over in .pdfhershbudhia1
 
The Finance Committee will oversee the financial activities .pdf
The Finance Committee will oversee the financial activities .pdfThe Finance Committee will oversee the financial activities .pdf
The Finance Committee will oversee the financial activities .pdfhershbudhia1
 
The Financial Accounting Standards Board FASB is a private.pdf
The Financial Accounting Standards Board FASB is a private.pdfThe Financial Accounting Standards Board FASB is a private.pdf
The Financial Accounting Standards Board FASB is a private.pdfhershbudhia1
 
The figure below shows a simple network Using the BellmanF.pdf
The figure below shows a simple network Using the BellmanF.pdfThe figure below shows a simple network Using the BellmanF.pdf
The figure below shows a simple network Using the BellmanF.pdfhershbudhia1
 
The figure here shows the current dwarf planets of our solar.pdf
The figure here shows the current dwarf planets of our solar.pdfThe figure here shows the current dwarf planets of our solar.pdf
The figure here shows the current dwarf planets of our solar.pdfhershbudhia1
 
The figure below shows two membrane proteins A and B inv.pdf
The figure below shows two membrane proteins  A and B  inv.pdfThe figure below shows two membrane proteins  A and B  inv.pdf
The figure below shows two membrane proteins A and B inv.pdfhershbudhia1
 
The FBI wants to determine the effectiveness of their 10 10 .pdf
The FBI wants to determine the effectiveness of their 10 10 .pdfThe FBI wants to determine the effectiveness of their 10 10 .pdf
The FBI wants to determine the effectiveness of their 10 10 .pdfhershbudhia1
 
The Ethisphere instituteethispherecom every year publishe.pdf
The Ethisphere instituteethispherecom every year publishe.pdfThe Ethisphere instituteethispherecom every year publishe.pdf
The Ethisphere instituteethispherecom every year publishe.pdfhershbudhia1
 
The essential steps in relative valuation are A Find compa.pdf
The essential steps in relative valuation are A Find compa.pdfThe essential steps in relative valuation are A Find compa.pdf
The essential steps in relative valuation are A Find compa.pdfhershbudhia1
 
the evidence indicated that the two sexes are more alike tha.pdf
the evidence indicated that the two sexes are more alike tha.pdfthe evidence indicated that the two sexes are more alike tha.pdf
the evidence indicated that the two sexes are more alike tha.pdfhershbudhia1
 
The Ethical Legal and Social Implications ELSI Program o.pdf
The Ethical Legal and Social Implications ELSI Program o.pdfThe Ethical Legal and Social Implications ELSI Program o.pdf
The Ethical Legal and Social Implications ELSI Program o.pdfhershbudhia1
 
The EPA Assigns wetlands to to two categories and NOAA iden.pdf
The EPA Assigns wetlands to to two categories and NOAA iden.pdfThe EPA Assigns wetlands to to two categories and NOAA iden.pdf
The EPA Assigns wetlands to to two categories and NOAA iden.pdfhershbudhia1
 
The environmental agency from Homework 5 is asking for your .pdf
The environmental agency from Homework 5 is asking for your .pdfThe environmental agency from Homework 5 is asking for your .pdf
The environmental agency from Homework 5 is asking for your .pdfhershbudhia1
 

More from hershbudhia1 (20)

aSuppose that we identify 145 women 50 to 54 years of age .pdf
aSuppose that we identify 145 women 50 to 54 years of age .pdfaSuppose that we identify 145 women 50 to 54 years of age .pdf
aSuppose that we identify 145 women 50 to 54 years of age .pdf
 
Asthma is a common respiratory pathology How do you think t.pdf
Asthma is a common respiratory pathology How do you think t.pdfAsthma is a common respiratory pathology How do you think t.pdf
Asthma is a common respiratory pathology How do you think t.pdf
 
Assume you are given a pointer to the root node of a complet.pdf
Assume you are given a pointer to the root node of a complet.pdfAssume you are given a pointer to the root node of a complet.pdf
Assume you are given a pointer to the root node of a complet.pdf
 
Assume you have two lists named list1 and list2 that are of .pdf
Assume you have two lists named list1 and list2 that are of .pdfAssume you have two lists named list1 and list2 that are of .pdf
Assume you have two lists named list1 and list2 that are of .pdf
 
Assuming a parent isotope with a halflife 45 billion year.pdf
Assuming a parent isotope with a halflife 45 billion year.pdfAssuming a parent isotope with a halflife 45 billion year.pdf
Assuming a parent isotope with a halflife 45 billion year.pdf
 
Assume that you have a class that has an integer pointer as .pdf
Assume that you have a class that has an integer pointer as .pdfAssume that you have a class that has an integer pointer as .pdf
Assume that you have a class that has an integer pointer as .pdf
 
Assume there are no taxes or risk of bankruptcy The assets .pdf
Assume there are no taxes or risk of bankruptcy The assets .pdfAssume there are no taxes or risk of bankruptcy The assets .pdf
Assume there are no taxes or risk of bankruptcy The assets .pdf
 
The figure below describes the process of crossing over in .pdf
The figure below describes the process of crossing over in .pdfThe figure below describes the process of crossing over in .pdf
The figure below describes the process of crossing over in .pdf
 
The Finance Committee will oversee the financial activities .pdf
The Finance Committee will oversee the financial activities .pdfThe Finance Committee will oversee the financial activities .pdf
The Finance Committee will oversee the financial activities .pdf
 
The Financial Accounting Standards Board FASB is a private.pdf
The Financial Accounting Standards Board FASB is a private.pdfThe Financial Accounting Standards Board FASB is a private.pdf
The Financial Accounting Standards Board FASB is a private.pdf
 
The figure below shows a simple network Using the BellmanF.pdf
The figure below shows a simple network Using the BellmanF.pdfThe figure below shows a simple network Using the BellmanF.pdf
The figure below shows a simple network Using the BellmanF.pdf
 
The figure here shows the current dwarf planets of our solar.pdf
The figure here shows the current dwarf planets of our solar.pdfThe figure here shows the current dwarf planets of our solar.pdf
The figure here shows the current dwarf planets of our solar.pdf
 
The figure below shows two membrane proteins A and B inv.pdf
The figure below shows two membrane proteins  A and B  inv.pdfThe figure below shows two membrane proteins  A and B  inv.pdf
The figure below shows two membrane proteins A and B inv.pdf
 
The FBI wants to determine the effectiveness of their 10 10 .pdf
The FBI wants to determine the effectiveness of their 10 10 .pdfThe FBI wants to determine the effectiveness of their 10 10 .pdf
The FBI wants to determine the effectiveness of their 10 10 .pdf
 
The Ethisphere instituteethispherecom every year publishe.pdf
The Ethisphere instituteethispherecom every year publishe.pdfThe Ethisphere instituteethispherecom every year publishe.pdf
The Ethisphere instituteethispherecom every year publishe.pdf
 
The essential steps in relative valuation are A Find compa.pdf
The essential steps in relative valuation are A Find compa.pdfThe essential steps in relative valuation are A Find compa.pdf
The essential steps in relative valuation are A Find compa.pdf
 
the evidence indicated that the two sexes are more alike tha.pdf
the evidence indicated that the two sexes are more alike tha.pdfthe evidence indicated that the two sexes are more alike tha.pdf
the evidence indicated that the two sexes are more alike tha.pdf
 
The Ethical Legal and Social Implications ELSI Program o.pdf
The Ethical Legal and Social Implications ELSI Program o.pdfThe Ethical Legal and Social Implications ELSI Program o.pdf
The Ethical Legal and Social Implications ELSI Program o.pdf
 
The EPA Assigns wetlands to to two categories and NOAA iden.pdf
The EPA Assigns wetlands to to two categories and NOAA iden.pdfThe EPA Assigns wetlands to to two categories and NOAA iden.pdf
The EPA Assigns wetlands to to two categories and NOAA iden.pdf
 
The environmental agency from Homework 5 is asking for your .pdf
The environmental agency from Homework 5 is asking for your .pdfThe environmental agency from Homework 5 is asking for your .pdf
The environmental agency from Homework 5 is asking for your .pdf
 

Recently uploaded

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
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
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
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
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
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
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
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
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 

Recently uploaded (20)

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
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
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
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
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
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
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.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
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 

The Fibonacci numbers are defined by the series 0 1 1 2 .pdf

  • 1. The Fibonacci numbers are defined by the series 0, 1, 1, 2, 3, 5, 8 ,13, ... Write a program that implements the Fibonacci series. Implement a program that prompts the user for an integer n and prints the nth Fibonacci number, using the following algorithm. First, Take care of negative numbers that are not defined by this series by printing an appropriate message. Next, take care of the initial conditions: fib1 = 1 fib2 = 1 fnew = fib1 + fib2 After that, compute an updated value of fnew, fib1, and fib2, per loop iteration. Repeat an appropriate number of times. Print the result as in the sample runs, below. using bython