Fibonacci number Series In Java


Simple Java Program for Fibonacci Number series
I’ve not programming a lot ever since. Here is my simple program about Fibonacci Number Series.
It’s kinda dumb, but its basic. haha.,,,,, No interesting topic to do…

————————————————————
public class Fibonacci {
public static int fib(int n) {
if (n < 2) {
return n;
}
else {
return fib(n-1)+fib(n-2);
}
}

public static void main(String[] args) {
for (int i=0; i<=46; i++)
System.out.println(fib(i)+", ");
}

}
————————————————————————

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: