Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

math456 Group Title

Need help in LMC coding: Calculate the sum from 1 to a number inputted by users For example, if user inputs 5, calculate 1+2+3+4+5 and output 15...

  • one year ago
  • one year ago

  • This Question is Closed
  1. math456 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    • one year ago
  2. math456 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    @KonradZuse @Callisto ?

    • one year ago
  3. math456 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    I hv the flowchart idk how to convert into code?

    • one year ago
  4. rsmith6559 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    You could start by choosing one symbol from the flowchart and code for it. Then do it again and again until you have all the symbols coded. Then you just have to "smooth out" the code between the symbols. When in doubt, decompose (break down) the problem into smaller problems. Eventually a solution will appear.

    • one year ago
  5. math456 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    @ParthKohli need help!!

    • one year ago
  6. math456 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    inp sto value out add N brp value sub value out bra value add n hlt its not compiling.. >.<

    • one year ago
  7. Meepi Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    INP STA SUM LOOP SUB ONE STA TEMP LDA SUM ADD TEMP STA SUM LDA TEMP BRZ QUIT BRA LOOP QUIT LDA SUM OUT HLT ONE DAT 1 SUM DAT TEMP DAT

    • one year ago
  8. math456 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    thanks meepi, can u explains the branching part?

    • one year ago
  9. math456 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    explain*

    • one year ago
  10. Meepi Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    First we store the input in SUM Then we substract 1 from the accumulator, and store the new number in TEMP next we load SUM into the accumulator, and add TEMP and we store this in SUM again then we load temp into the accumulator BRZ check if temp is 0, in which case we're finished (5 + 4 + 3 + 2 + 1 + 0, we have the sum), and if it is we branch to QUIT otherwise we use BRA to go back to the top of the loop and repeat the process

    • one year ago
  11. math456 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    alright so u took temp as a variable to store the new #?

    • one year ago
  12. Meepi Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    each iteration of the loop temp gets lowered by 1 and added to the sum in SUM if temp is 0 we're done temp is used as a countdown from input to 0, and each time the loop runs we add it to sum and substract 1 from it

    • one year ago
  13. math456 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    got it now! thank you very much for your help! I appreciated!

    • one year ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.