Tuesday, June 1, 2021

JAVA Program to print first 10 numbers in Fibonacci series.

PROGRAM :

package com.company;

public class Fibo

{

        public static void main(String[] args)

        {

                int a,b,temp,n;

                a=0;

                b=1;

         for(n=1;n<=10;n++)

         {

                System.out.println(a);

                temp=a+b;

                a=b;

                b=temp;

         }

        }

}


OUTPUT :



 


Labels: