Generating Fibonacci Sequence

0 votes
var x = 0;
var y = 1;
var z;

fib[0] = 0;
fib[1] = 1;

for (i = 2; i <= 10; i++) {
  alert(x + y);
  fib[i] = x + y;
  x = y;
  z = y;
}

I'm attempting to produce a basic Fibonacci sequence, but there is no output.

Could someone please tell me what's wrong?

Nov 17, 2022 in Java by Nicholas
• 7,760 points
348 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Java

0 votes
1 answer

Generating an MD5 hash?

The MessageDigest class can provide you with an instance ...READ MORE

answered Jun 13, 2018 in Java by Rishabh
• 3,620 points
1,090 views
0 votes
1 answer

Generate 10 fibonacci numbers.

The placement of logic is wrong that ...READ MORE

answered Nov 21, 2018 in Java by Nabarupa
951 views
0 votes
0 answers

Generating PDF files with JavaScript

I was hoped that I could accomplish ...READ MORE

Sep 28, 2022 in Java by Nicholas
• 7,760 points
285 views
0 votes
0 answers

Generating random whole numbers in JavaScript in a specific range

How can I create random whole numbers ...READ MORE

Sep 28, 2022 in Java by Nicholas
• 7,760 points
408 views
0 votes
1 answer

Presenting docket dtates inside html page by javascript

Use the Docker Engine Api:Docker Engine API ...READ MORE

answered Jun 20, 2018 in Docker by DareDev
• 6,890 points
476 views
0 votes
1 answer

Migrating proxy npm repo in nexus 3

I don't think you can achieve this ...READ MORE

answered Jun 22, 2018 in DevOps Tools by DareDev
• 6,890 points
1,190 views
+1 vote
1 answer

What is the difference between JavaScript and Java

This quote rightly explains that 2 totally ...READ MORE

answered Jun 29, 2018 in Java by Daisy
• 8,120 points
555 views
+1 vote
1 answer

How to write the Fibonacci Sequence?

Efficient Pythonic generator of the Fibonacci sequence I ...READ MORE

answered Aug 21, 2018 in Python by Priyaj
• 58,090 points
1,000 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP