Computer Science, asked by qnabrainly124, 24 days ago

Please solve q8 only. Solve it correctly.​

Attachments:

Answers

Answered by Anonymous
1

Answer:

The program will be written as follows -

//Program to display the first 10 terms of the Fibonacci Series

public class FibonacciSeries_02

{

   public static void main(String[] args)

   {

       //Declaration

       int n, term1, term2, term3;

       //Initialization

       n = 10;

       term1 = 0;

        term2 = 1;

       

       //Calculate and display the fibonacci series

       for (int i =1; i <= n; i++)

       {

           System.out.print(term1 + " ");

           //Calculate the next to next term

           term3 = term2 + term1;

           term1 = term2;

           term2 = term3;

       }

   }

}

Hope you like it

Similar questions