+3 votes
in Class 12 by kratos

Write a Program in Java to display the first 10 numbers of the Fibonacci series

1 Answer

+2 votes
by kratos
 
Best answer

public class Fibonacci

{

public static void main ( )

{

int a, b, c;

a = 0

b = 1;

c = 0;

n = 3;

System.out.printIn (“The series is”);

System.out.printIn (a);

System.out.printIn (b);

do // You can use any loop. Do while loop is comparatively straight forward.

{

c = a + b;

System.out.println(c);

a = b;

b = c;

n = n + 1;

}

while (n<=10);

}

}

...