#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    2
    Rep Power
    0

    Question How can I possibly know the value?


    Label, INPUT
    SUBT Value
    ADD Data
    STORE Data
    LOAD Times
    SUBT 1
    STORE Times
    SKIPCOND 400
    JUMP Label
    Value, DEC 10
    Data, DEC 0
    Times, DEC 5

    I have to find the value of Data after the end of the program, but it depends on what the 5 values the user inputs, so it doesn't make sense... I can't possibly know what the value will be, right?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2007
    Posts
    765
    Rep Power
    928
    When posting code place it between [code]...[/code] tags so that it retains formatting.

    This forum is for any language that doesn't have its own forum, so it's a good idea to specify what you're using.

    You teacher may want you to express the answer symbolically dependent on the input. Or it may be that the answer will be the same regardless of input.
    sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    2
    Rep Power
    0
    the language i am using is marie assembly

    the answer you gave me wasn't helpful at all

    it's like saying i don't know
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2007
    Posts
    765
    Rep Power
    928
    Well yes, I don't know. I'm not in your class so I don't know what your teacher expects, and the language you're working in isn't one I can recognize off hand.

    Anyways, without knowing the inputs you can't say what the exact value of DATA is, though you can certainly describe the ending value of DATA in terms like "the sum of ... less ...". You'd have to check with your teacher/instructions.

    Or your teacher could be expecting you to notice the lack of a HALT and to determine what instruction is encoded by "Value, DEC 10" and continue executing from there--which if I figure correctly will write a constant value to DATA before jumping outside of the program and (hopefully) crashing.
    sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);

IMN logo majestic logo threadwatch logo seochat tools logo