a) Generate and display the following 10 numbers from the Fibonacci series using a do while loop and an if else statement inside the loop. {0} [1] [1] {2} [3] [5] {8} [13] [21] {34} [55]  The series must be generated programmatically. \ Note that  odd numbers and even numbers are displayed in [] and {} respectively. (10) (b) Write code that uses a while loop and an if else statement inside the loop to echo out  the following: (10) Month 1 - Summer  Month 2 - Summer   ICT2613/103/0/2023 9  Month 3 - Autumn  Month 4 - Autumn  Month 5 - Autumn  Month 6 - Winter  Month 7 - Winter  Month 8 - Winter  Month 9 - Spring  Month 10 - Spring  Month 11 - Spring  Month 12 - Summer  (c) Write a switch statement in a function that will initialize the variable $result to the string  'Summer' for numbers 1, 2 and 12, 'Autumn' for numbers 3 to 5, 'Winter' for numbers 6 to  8, 'Spring' for numbers 9 to 11, and 'Unknown' for numbers other than 1 to 12. The switch  statement must be coded with only 5 cases including the default case. Echo out the content of  $result after the switch statement in the function. Invoke the function three times with  values 3, 5, 10, 12 and 20

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

(a) Generate and display the following 10 numbers from the Fibonacci series using a do while
loop and an if else statement inside the loop.
{0} [1] [1] {2} [3] [5] {8} [13] [21] {34} [55] 
The series must be generated programmatically. \ Note that 
odd numbers and even numbers are displayed in [] and {} respectively. (10)
(b) Write code that uses a while loop and an if else statement inside the loop to echo out 
the following: (10)
Month 1 - Summer 
Month 2 - Summer 
 ICT2613/103/0/2023

Month 3 - Autumn 
Month 4 - Autumn 
Month 5 - Autumn 
Month 6 - Winter 
Month 7 - Winter 
Month 8 - Winter 
Month 9 - Spring 
Month 10 - Spring 
Month 11 - Spring 
Month 12 - Summer 
(c) Write a switch statement in a function that will initialize the variable $result to the string 
'Summer' for numbers 1, 2 and 12, 'Autumn' for numbers 3 to 5, 'Winter' for numbers 6 to 
8, 'Spring' for numbers 9 to 11, and 'Unknown' for numbers other than 1 to 12. The switch 
statement must be coded with only 5 cases including the default case. Echo out the content of 
$result after the switch statement in the function. Invoke the function three times with 
values 3, 5, 10, 12 and 20

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education