There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Software Development
Tag Cloud
audio blue screen boot bsod computer cpu crash dell desktop driver drivers error excel external hard drive firefox freezes freezing hard drive hardware hijackthis internet internet explorer itunes laptop malware monitor motherboard mouse network networking outlook 2007 power printer problem ram router screen slow sound spyware trojan usb virus vista vista 32-bit windows windows xp windowsxp winxp wireless
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Java sequence generator


Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
Boe's Avatar
Boe Boe is offline
Account Disabled with 16 posts.
 
Join Date: Sep 2004
03-Nov-2004, 11:50 AM #1
Java sequence generator
Hello everyone. I am not trying to get someone to do my homework for me but I am stuck on a program. I dont know if you are familiar with the "fibonacci generator". The first two nubers of the sequence are 1. The third number it always the sum of the prior two numbers. the third number is the sum of 1 and 1. third number = 2. the fourth number is the some of the 2nd and 3rd digit. the seguence reads as follows... 1,1,2,3,5,8,13,21.... so on. anyways, I need to write a generator to figure out this sequence so when a user enters a digit number, like the 16 fib number, then generator will tell the user what the actual number is.
Chicon's Avatar
Computer Specs
Distinguished Member with 6,695 posts.
 
Join Date: Jul 2004
Location: 50° 34' 07.13" N - 04° 10' 23.
Experience: Second socks retriever
04-Nov-2004, 04:14 AM #2
Hi Boe,

Quote:

// Fibonacci generator
// fill an array of 500 fibonacci numbers
//
int a[] = new int[500];
a[0] = 1;
a[1] = 1;
for (int i = 2; i < 500; i++)
{
a[i] = a[i-1] + a[i-2];
}

// Display the Fibonacci number

int userValue = value entered by the user

System.out.println("Fibonacci number " + userValue + " = " + a[userValue - 1]);
Boe's Avatar
Boe Boe is offline
Account Disabled with 16 posts.
 
Join Date: Sep 2004
04-Nov-2004, 01:31 PM #3
Alright thanks. I did finally figure it out yesterday, but your help is most appreciated.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 10:39 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.