add - What is wrong with my beginner Brainfuck addition program? -
i've been working on programming challenge: http://www.codeabbey.com/index/task_view/summing-up
which states:
input data has 2 values , b in single line. output should have sum a+b printed it. additionally after stop program should have values a, b, a+b in cells 0, 1 , 2 respectively.
so example input this:
9 26
now, think misunderstanding either problem or solution because believe solution supposed 9 26 35
9, 26, , 35 in own cells.
my solution returns 9 26 35
, believe in correct cells (0,1, , 2 respectfully) getting answer wrong. can please @ problem , code , tell me going wrong?
code:
;:>;:><[-<+>]<:
i tried plugging couple of online brainfuck interpreters. there 1 here:
and here:
http://esoteric.sange.fi/brainfuck/impl/interp/i.html
in both cases, needed change character set --> : becomes . , ; becomes ,
the output both was
9 y
notice 35 - 9 = 24, , y 24th letter of alphabet. think outputting number "35" , having interpretted letter.
i try changing program output literally single digits of answer -- ie, output 3, output 5, instead of outputting numerical "35" (but leave numerical value in cell 2 @ end). in other words, text output should formatted version of values in memory, rather outputting numerical values directly.
Comments
Post a Comment