Team-ClanX.org Forum Index Team-ClanX.org
Web Board for the ClanX Team
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    Return homeReturn Home 

Fibonacci Numbers 1 To N

 
Post new topic   Reply to topic    Team-ClanX.org Forum Index -> Java
View previous topic :: View next topic  
Author Message
Opposite^Force
Super scripter


Joined: 12 Aug 2004
Posts: 172
Location: Turkey, Istanbul

PostPosted: Sun Jul 29, 2007 10:21 am    Post subject: Fibonacci Numbers 1 To N Reply with quote

Code:
import javax.swing.*;

public class T {
   public static void main(String[] args) {
      int a = Integer.parseInt(JOptionPane.showInputDialog(null,"Enter N: "));
      int i,t,u,m; i = t = u = m = 1;
      while (i <= a) {
         System.out.print(t);
         if (i != a) { System.out.print("-"); }
         i++;
         m = t;
         t = u;
         u = u + m;   
      }      
      System.out.println("");
   }
}


This program will show you all the fibonacci numbers between 1-N Wink
_________________
Opposite^Force
Team Clan X Scripter
Email: oscripts@aa-labs.com
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Team-ClanX.org Forum Index -> Java All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group