Computer Science, asked by star4731, 3 months ago

java write the program to display the fibonacci series between 1 to 200​

Answers

Answered by kamalrajatjoshi94
2

Answer:

Program:-

public class Fibonacci

{

public static void main(String args[ ])

{

int a=0,b=1,c=0,n=0;

System.out.println(a);

System.out.println(b);

while(n<=200)

{

c=a+b;

System.out.println(c);

a=b;

b=c;

n++;

}

}

}

Answered by BrainlyProgrammer
7

//Program to display fibbonacci series between 1 to 200

package Programmer;

public class FibboSeries {

public static void main(String[] args) {

int a=0,b=1,c=0;

for(int i=1;a<=200;i++){

System.out.println(a);

c=a+b;

a=b;

b=c;

}

}

}

________

Variable Description:-

  • I:- loop variable
  • a:- Local variable to print fibbonacci series
  • b:- local variable to store the next term
  • c:- local variable to calculate the sum of a and b

____

•Output attached

Attachments:
Similar questions