To generate fibonacci series class Main { public static void main(String[] args) { int n = 10, firstTerm = 0, secondTerm = 1; System.out.println("Fibonacci Series till " + n + " terms:"); for (int i = 1; i <= n; ++i) { System.out.print(firstTerm + ", "); // compute the next term int nextTerm = firstTerm + secondTerm; firstTerm = secondTerm; secondTerm = nextTerm; } } }
-
Notifications
You must be signed in to change notification settings - Fork 0
ShaaviGupta/fibonacci
About
To generate fibonacci series
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published