Write a c program to find Fibonacci numbers. if the answer helped me I will mark you the BRAINLIEST
Answers
Answered by
2
here is your answer......
Attachments:
Answered by
1
Class fibon
{
Public static void main ( String args [ ] )
{
Int a =0, b=1, c=0;
for ( int I = 1; I < = 10; i + + )
{
c= a+b;
System.out.println ( c );
a=b;
b=c;
}
}
}
This program will print the first 10 fibonnacci numbers as the loop runs for ten times.
variable a and b store the first two numbers and then sum (that is the fibonnacci number ) is stored in variable c and printed.
Thank u ★ ★ ★
#ckc
{
Public static void main ( String args [ ] )
{
Int a =0, b=1, c=0;
for ( int I = 1; I < = 10; i + + )
{
c= a+b;
System.out.println ( c );
a=b;
b=c;
}
}
}
This program will print the first 10 fibonnacci numbers as the loop runs for ten times.
variable a and b store the first two numbers and then sum (that is the fibonnacci number ) is stored in variable c and printed.
Thank u ★ ★ ★
#ckc
Similar questions