0% found this document useful (0 votes)
30 views3 pages

TUTORIAL REPETITION (C++)

The document provides an explanation of the Fibonacci sequence, where each number is the sum of the previous two numbers, starting with 0 and 1. It gives an example of the first 10 terms and provides a formula to calculate the nth term. It then asks to write a C++ program using a for loop that takes a range as input and displays the Fibonacci sequence up to that term.

Uploaded by

Coi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views3 pages

TUTORIAL REPETITION (C++)

The document provides an explanation of the Fibonacci sequence, where each number is the sum of the previous two numbers, starting with 0 and 1. It gives an example of the first 10 terms and provides a formula to calculate the nth term. It then asks to write a C++ program using a for loop that takes a range as input and displays the Fibonacci sequence up to that term.

Uploaded by

Coi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

TUTORIAL REPETITION_ MARCH15

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…

The rules of obtaining the Fibonacci sequence are shown below:

Fn = 0, F1= 1; where Fn is the first term

F2= Fn + F1 = 0 + 1 =1

F3= F2 + F1 = 1 + 1 = 2

F4= F3 + F2 = 2+ 1 = 3

F5= F4 + F3 = 3 + 2 = 5

…..

…..

Fm= Fm-1 + Fm-2

Using a for-loop repetition structure, write a complete C++ program to display the Fibonacci sequence
as given in the sample output below:

Enter range for terms of Fibonacci sequence: 10 [enter]

Fibonacci series up to 10 terms:

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:

You might also like