Java Blog

 
 
 
import java.io.*;

class  Fibonacci
{
    public static void main(String args[]) 
    {
        String str;
        int no,f1,f2,f3;
        f2=0;
        f3=1;

        try{
             System.out.print(\"Enter number to generate it\'s  Fibonacci Series : \");
             System.out.flush();
             BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));
             str=obj.readLine();
             no=Integer.parseInt(str);

             System.out.print(f3+\"  \");
             System.out.flush();
                  while(no>1)
                  {
                          f1=f2;
                          f2=f3;
                          f3=f1+f2;
                          System.out.print(f3+\"  \");
                          System.out.flush();
                          no=no-1;
                 }
             }
        catch(Exception e)
        {}
    }
}

    Related Post:
  1. Program to show an example of modifying String objects

  2. An applet program that display blinking rectangle

  3. Program to show an example of searching Strings for characters

  4. File handling program to display directory contents

  5. Corba program of Count Client Applet, IDL,Server, Client

  6. Program in CORBA which takes a long sentence from client (at least 7 words), passes to the server, server separates out each word and sends back

  7. Corba program to develop a simple calculator with addition, subtraction, multiplication and division capabilities, data collection from client side

  8. Develop a game application in CORBA for which the player will guess a number between 1 to 100, which will be compared to the random number generated b

  9. Program, which creates a three thread. One thread display the numbers from 1 to 5, second thread display the square root of that number etc

  10. Dialog Boxes

  11. Program of UDP news server

  12. Program to compute the sum of the digits of a given integer number. eg: I/o=4 then O/p=4+3+2+1=10

  13. Program to show the use of Labeled Continue Statement

  14. Program to show an example of using a Static Nested Class

  15. Program to display following things on the client machine a)date and time of the server machine b)date and time of the client machine and difference

  16. Develop a CORBA based application for addition of two complex numbers and displaying the result on client side

  17. An applet program to add two numbers where data is entered in TextField

  18. Program to show the use of the Continue Statement

  19. Program of Floyds Triangle

  20. Program which will read a string and rewrite it in the alphabetical order

 
 
Didn't find what you were looking for? Find more on Program to generate Fibonacci Series of a given number