Tagged: 

  • Fibonacci

     Akash  updated 9 months, 2 weeks ago 2 Members · 2 Posts
  • Akash 

    Administrator
    at

    Write a program to print fibonacci series

  • Akash 

    Administrator
    at

    import java.util.*;

    public class Fibonacci {

    public static void main(String args[])

    {

    Scanner scan=new Scanner(System.in);

    System.out.println(“Enter the number”);

    int n=scan.nextInt();

    int count1=0,count2=1,count3=0;

    System.out.println(“Fibonacci number”);

    System.out.println(count1+” “+count2);

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

    {

    count3=count1+count2;

    System.out.println(count3);

    count1=count2;

    count2=count3;

    }

    }

    }

Log in to reply.

Original Post
0 of 0 posts June 2018
Now
KodNest Training New Batch is starting on 21st September 2020. Attend one week free demo classes.Register Now

New Report

Close