Problem Statement 4

Write a program to generate a Fibonacci sequence {0,1,1,2,3,5,8….}. The count of numbers needed in the sequence is taken from the user.

SAMPLE INPUT

Enter a number:

15

SAMPLE OUTPUT

0 1 1 2 3 5 8 13 21 34 55 89 144 233 377

Sample Program:

Sample Output:

Enter the fibonacci sequence:
10
0
1
1
2
3
5
8
13
21
34

Any queries leave a comment please and thanks for reading this post.

2 comments

Leave a Reply

Your email address will not be published. Required fields are marked *