Klara

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.

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.