Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


dione
fibonacci
1 Answer(s)      6 years and 2 months ago
Posted in : Java Beginners



Advertisement
View Answers

October 11, 2008 at 12:54 PM


Hi friend

I hope the following code helps you

import java.io.*;
import javax.swing.JOptionPane;

class fibb
{

public static void main(String[] args)throws IOException
{

int[] fib=new int[100];
fib[0]=0;
fib[1]=1;
int num;
int i;

num=Integer.parseInt(JOptionPane.showInputDialog("Enter Number:"));

if(num>1)
{

for(i=2;i<=num;i++)
{

fib[i]=fib[i-1]+fib[i-2];
}
}

String str="";
for(i=0;i<num;i++)
str=str + " " +fib[i];

JOptionPane.showMessageDialog(null, str);


}

}


/***shiva**/


Related Tutorials/Questions & Answers:
factorial of fibonacci
factorial of fibonacci   A code for the factorial of a fibonacci series. Example when the user enters 6, the fibonacci series is 8 and the factorial will be 8! or 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1. So if the user enters the number 6
Fibonacci (Recursive)
Fibonacci (Recursive)  I need to write a program for my AP CS class... that give you the sequence of the Fibonacci numbers, but here is what it asks me... >= 0) and returns the appropriate Fibonacci number of the Fibonacci number
Advertisements
Fibonacci program
Fibonacci program  I am trying to write 2 different Fibonacci... out the next 10 numbers in the fibonacci sequence. On the next one, I want... fibonacci numbers they would like the program to print. I need to use a main
fibonacci series
fibonacci series  Program to print the first n fibonacci numbers using function.the program must use InputStreamReader and BufferedReader.  ...*; public class Fibonacci { public static void main(String[] args) throws Exception
fibonacci series logics
fibonacci series logics  A form contains 20 text fields, these fields.... Now we have fibonacci series number by which we have to find that numbers inserted by the user in fibonacci series or nearby. for each text field value. and show
sum of fibonacci series
sum of fibonacci series  Write a Java program to print Fibonacci series upto n and find their sum also. 0+1+1+2+3+5+8+13+21ΓΆβ?¬Β¦ΓΆβ?¬Β¦ΓΆβ?¬Β¦ΓΆβ?¬Β¦=sum   Hi, Please see the thread Fibonacci program. Thanks
fibonacci by using if/else - Framework
fibonacci by using if/else  Fib(n)=0 1 Fib(n-1)+Fib(n-2) if n=0 if n=1 Based on the above Fib() formula,write a C program that uses this main... a Fibonacci series.\n"); for(int looper=0;looper
fibonacci - Java Beginners
fibonacci  plss debug this program!!!! This program will diplay the fibonacci numbers when you input a number. import javax.swing.JOptionPane; public class Fibonacci { public static void main(String[] args) { int x
Fibonacci series in java
Fibonacci series in java In this section you will learn about fibonacci number in java.  Fibonacci number or Fibonacci sequence are the number... value proceeding it. Here is the code for Fibonacci program: import
Prime And Fibonacci Number Finder
Prime And Fibonacci Number Finder In this section, you will learn how to find the prime numbers which are generated in the fibonacci series. To compute...() of boolean type. After that we have stored the fibonacci number series of 10
javaprograms
javaprograms  write a program to display the 45th term of the Fibonacci series
java program code
java program code  can any one write a program (class) which will have two methods Fibonacci and Factorial, which will be a void and a return respectively. i will be glad if it can have a good display results
switch statement
switch statement   i want to write a java program that computes Fibonacci,factorial,string reversal and ackerman using switch case to run as a single program
Java - Java Beginners
Java    Write a multi-threaded Java program to print all numbers below 100,000 that are both prime and fibonacci number (some examples are 2, 3, 5... them into a pipe. Design another thread that generates fibonacci numbers
Need to develop Java Program - Development process
Need to develop Java Program  Write a multi-threaded Java program to print all numbers below 100,000 that are both prime and fibonacci number (some... fibonacci numbers and writes them to another pipe. The main thread should read
java - Java Beginners
java  Write a multi-threaded Java program to print all numbers below 100,000 that are both prime and fibonacci number (some examples are 2, 3, 5, 13... them into a pipe. Design another thread that generates fibonacci numbers
a Java program
a Java program    Write a Java program to print even numbers from 2 to 1024? Write a Java program to print ? My Name is Mirza? 100 times? Write a Java program to print Fibonacci Series? Write a Java program to reverse a number
programes on for loop
programes on for loop  a. write a program to find squares and cubes of 1st 10 integers b. write a program to to calculate factorial of a no, c. write a program to print Fibonacci series d. write a program to check whether entered
programes on for loop
programes on for loop  a. write a program to find squares and cubes of 1st 10 integers b. write a program to to calculate factorial of a no, c. write a program to print Fibonacci series d. write a program to check whether entered
programes on for loop
programes on for loop  a. write a program to find squares and cubes of 1st 10 integers b. write a program to to calculate factorial of a no, c. write a program to print Fibonacci series d. write a program to check whether entered
programes on for loop
programes on for loop  a. write a program to find squares and cubes of 1st 10 integers b. write a program to to calculate factorial of a no, c. write a program to print Fibonacci series d. write a program to check whether entered
dead line tomorrow...help
dead line tomorrow...help  1)write a program to convert double to int and viceversa using rmi(remote method invocation) 2)write a program to download a video file and run it on your client machine using rmi 3)fibonacci
JAVA - Java Beginners
prime and fibonacci number (some examples are 2, 3, 5, 13, etc.). Design a thread... another thread that generates fibonacci numbers and writes them to another pipe
JAVA - Java Beginners
prime and fibonacci number (some examples are 2, 3, 5, 13, etc.). Design a thread... another thread that generates fibonacci numbers and writes them to another pipe
sir i,have a another assignment for these question plz help me sir - JavaMail
that are both prime and fibonacci number (some examples are 2, 3, 5, 13, etc.). Design.... Design another thread that generates fibonacci numbers and writes them
java - Java Beginners
the array with the first n Fibonacci numbers. Then main reads a list of numbers... that uses the array to return the Fibonacci number in that position. Main stops when
java program - Java Beginners
java program  I have to make two radio buttons where one to show and one for clear.when u ser choose show button a fibonacci series will appear and on choosing clear the page will b cleared.how can i implement this?i cannot take
java programme - Java Server Faces Questions
java programme  Write a complete program, which prints all Fibonacci numbers that are less than 1600.  Hi Friend, Try the following code: public class FibonnaciSeries { public static void main(String[] args
java app
java app  create an applet to display the Fibonacci numbers   1)AppletExample.java: import java.awt.*; import java.applet.*; import...); label2 = new Label("Fibonacci Series: "); label2.setBounds
Series of long Integers
is prime or not   Hello Friend, 1)Fibonacci series: import java.util.*; public class Fibonacci { public static void main(String[] args) throws
java program - Java Beginners
java program  there are two buttons-one for "show" and the other for "clear".after pressing show button a fibonacci series will appear where each element of fibonacci series will appear 1fter 10 seconds.after pressing clear
Advertisements
 

 

 

DMCA.com