TUTORIAL REPETITION (C++)
TUTORIAL REPETITION (C++)
QUESTION 1
The Fibonacci sequence is a set of numbers that starts with a zero, followed by a one, and proceeds
based on the rule that each number (called a Fibonacci number) is equal to the sum of the first two
numbers. The Fibonacci sequence is denoted by F(n), where n is the first term in the sequence. The
following equation is obtained when n= 0, where the first two terms are 0 and 1, and each subsequent
number is the sum of the previous two numbers.
For example, if and only if n is 0, then F(n) = F(0) = 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144…
F2= Fn + F1 = 0 + 1 =1
F3= F2 + F1 = 1 + 1 = 2
F4= F3 + F2 = 2+ 1 = 3
F5= F4 + F3 = 3 + 2 = 5
…..
…..
Using a for-loop repetition structure, write a complete C++ program to display the Fibonacci sequence
as given in the sample output below:
0 1 1 2 3 5 8 13 21 34
ANSWER:
QUESTION 2
Using while loop, writes a program segment to accept the weight of 10 students. The program counts
and display the number of students whose weight is more than 75 kilograms.
ANSWER: