Computer Science, asked by Sounak2005, 5 months ago

Write a program finding the sum of Fibonacci Numbers upto 200 in Bluej.​

Answers

Answered by atrs7391
1

Answer:

If you have any problem related to it ask me down:

Attachments:

atrs7391: please again comment me if it works as I didn't tested as I am now on my phone
atrs7391: hope this solves your issue I will be glad
atrs7391: and most probably I'll test it by tomorrow and comment you the correct program if this won't work.
Sounak2005: Ok
Sounak2005: Thank you
Sounak2005: I will test tomorrow as I am also on phone now.
anindyaadhikari13: Sum of first 200 Fibonacci numbers or sum of Fibonacci numbers below 200? what is your question?
atrs7391: well its sum of Fibonacci numbers below 200
atrs7391: TBH i was also confused with it what you want
anindyaadhikari13: Okay. Wait. Answering.
Answered by anindyaadhikari13
3

Required Answer:-

Question:

  • Write a program to find out the sum of Fibonacci Numbers below 200 in Java.

Solution:

Here is the program.

public class FibonacciSum {

public static void main(String[] args) {

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

int s=0;

while(c<=200) {

s+=c;

c=a+b;

a=b;

b=c;

}

System.out.println("Sum: "+s);

}

}

Explanation:

  • We will just calculate each term of series and store the sum in variable s. If the term of the series exceeds 200, the loop will be terminated.

Output is attached.

Attachments:
Similar questions