22:40

Fibonacci

Posted by Mitesh Patel |


class FiboExample {

    public static void main(String args[]) {

        int first = 0 , second = 1 ,third;
        int i;
        for(i=1;i<=15;i++)
        {
            System.out.println(" " + second);
            third = first + second;
            first = second;
            second = third;
        }

    }
}

0 comments:

Post a Comment

Subscribe