DEV Community

Discussion on: Daily Coding Puzzles

Collapse
 
sam_ferree profile image
Sam Ferree

Okay, just pipe the number of even terms you want into STDIN (an input of 4 will display the sum of the first 4 even terms of fibonacci) and you're good to go.

Befunge 93:

188p199p&1                     v
88g99g+88p88g99g+:99p+\1-:!#v_\>
                            >\.@

Kind of disappointed as this solution uses get and put and therefore is less... "fungical"? but trying to do this all on a single stack got away from me.

A Funge++ solution might look more elegant...

Collapse
 
sam_ferree profile image
Sam Ferree • Edited

Here we go, MUCH happier with this Funge++ solution:

&}1}1      v
{{1-:!#v_}}>:[+:]+
       >}.@