write a program to accept a number and display fibonacci series upto that number.Display an appropriate message if that number does not exist in the series.
pls be accurate .Answer only if you know.*****NO SPAMMING PLEASE*****
sp2003:
IN JAVA
Answers
Answered by
0
Example on how to display the Fibonacci sequence of first n numbers (entered by the user) using loop.Also in different example, you learn to generate the Fibonacci sequence up to a certain number.
0, 1, 1, 2 , 3, 5, 8 ,13 , 21 , 34 ,55 ,89 ,144
To understand this example, you should have the knowledge of following C programming topics:
* C programming Operators
* C programming while and do ... while loop.
* C programming for loop.
* programming break and continue statement.
# include<stdio.h>
int main ( )
{
int I , n, t1=0,t2 = 1. , next term ;
printed("Enter the vnmber of terms:")
Scandinavian("% d " ,&n) ;
printed("Fibonacci series:")
for (I. =1; I <= n; ++i)
{
printed("%d, "t1)
next term =t1+t2
t1 = t2
t2 = next term
}
return 0;
}
0, 1, 1, 2 , 3, 5, 8 ,13 , 21 , 34 ,55 ,89 ,144
To understand this example, you should have the knowledge of following C programming topics:
* C programming Operators
* C programming while and do ... while loop.
* C programming for loop.
* programming break and continue statement.
# include<stdio.h>
int main ( )
{
int I , n, t1=0,t2 = 1. , next term ;
printed("Enter the vnmber of terms:")
Scandinavian("% d " ,&n) ;
printed("Fibonacci series:")
for (I. =1; I <= n; ++i)
{
printed("%d, "t1)
next term =t1+t2
t1 = t2
t2 = next term
}
return 0;
}
Similar questions
Chemistry,
8 months ago
Social Sciences,
1 year ago
History,
1 year ago
Science,
1 year ago
Hindi,
1 year ago