codedamn

Print the n numbers of fibonacci series.

Created by Piyush Garg about a year ago

0

No description provided

2 Comments

    0

    import java.util.Scanner; public class Main {

    public static void main(String args[]) { Scanner scan = new Scanner(System.in); System.out.print("Input: "); int n = scan.nextInt(); int first = 0; int second = 1; System.out.println(first); System.out.println(second);

      for(int i = 2; i< n; i++ ){
         int next = first + second;
         System.out.println(next);
         first = second;
         second = next;
      }
    

    } }

    //This works fine. But still Does not pass the test case, and I'm getting fed up with this challenges not passing.

    @pranshubasak

    Pranshu Basak

    @pranshubasak

    0

    import java.util.Scanner; public class Main {

    public static void main(String args[]) { Scanner scan = new Scanner(System.in); System.out.print("Input: "); int n = scan.nextInt(); int first = 0; int second = 1; System.out.println(first); System.out.println(second);

      for(int i = 2; i< n; i++ ){
         int next = first + second;
         System.out.println(next);
         first = second;
         second = next;
      }
    

    } }

    //This works fine. But still Does not pass the test case, and I'm getting fed up with this challenge not passing.

    @pranshubasak

    Pranshu Basak

    @pranshubasak

Your comment