alarm
Ask a question for free
Computer Science
Klara

Write a program to find the sum of 1st 10 numbers of Fibonacci series i.e. 1,1,2,3,5,8,13….Fibonacci series is such a series which starting from 1 and 1, and subsequent numbers are the sum of the previous two numbers.

answers: 1
Register to add an answer
Answer:
Required Answer:-Question:
  • Write a program to find the sum of 1st ten numbers of Fibonacci Series.
Solution:

This is an easy question. Read this post to get your answer.

Here is the program. This is written in Java.

public class FibonacciSum {

public static void main(String[] args) {

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

for(int i=1;i<=10;i++) {

c=a+b;

a=b;

b=c;

sum+=c;

}

System.out.println("Sum is: "+sum);

}

}

★ We need to find each term of the Fibonacci series and add them up. We will store the sum in a variable and display it. Each term of the Fibonacci series is the sum of previous two terms.

Output is attached.

405
cork
For answers need to register.