aboutsummaryrefslogtreecommitdiff
path: root/challenge-150/abigail/node/ch-1.js
blob: 4a716a5c6a0915bd2e15215be102da05322f4cb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/local/bin/node

//
// See https://theweeklychallenge.org/blog/perl-weekly-challenge-150
//

//
// Run as: node ch-1.js < input-file
//

  require ('readline')
. createInterface ({input: process . stdin})   
. on              ('line', line => {
    let [fib_prev, fib_last] = line . trim () . split (" ")
    while (fib_last . length < 51) {
        let fib_tmp = fib_last
        fib_last    = fib_prev + fib_last
        fib_prev    = fib_tmp
    }
    console . log (fib_last [50])
})