Day 30: Fibonacci Series of N Numbers of 100DaysCodingChallenge
Hello all,
I have started the 100 days of coding challenge to improve my programming skills..
Today is the Day30 of 100DaysCodingChallenge for
Fibonacci Series of N Numbers input Numbers taken by the user.
Code :
let n = prompt("Enter N : "); let f1 = 0; let f2 = 1; let f = f1 + f2; let fs = 0; console.log("Fibonacci Series upto", n+"th term is : "); console.log(f1); console.log(f2); for (let i = 3; i <= n; i++) { // console.log(f1); // console.log(f2); // console.log(f1, f2); console.log(f); f1 = f2; f2 = f; f = f1 + f2; }
Output :
Happy Coding:)
Thank you...
Comments
Post a Comment