A community for students.
Here's the question you clicked on:
 0 viewing
anonymous
 3 years ago
exercise 1.15, I get the problem and what prints out, but what is the sequence of numbers that the guy wants to print or what would the sequence be used for, second part of the exercise?
anonymous
 3 years ago
exercise 1.15, I get the problem and what prints out, but what is the sequence of numbers that the guy wants to print or what would the sequence be used for, second part of the exercise?

This Question is Open

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0I don’t completely understand which sequence you’re talking about, but I did find the Exercise 1.15 a lot more sensible when I did also the optional part of it.

andrew.m.higgs
 3 years ago
Best ResponseYou've already chosen the best response.1I also struggled to understand what the program was intended to do. I guess this illustrates the importance of commenting code.

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0Can you solve it just by using commenting code or do you need to tinker with the code as well?

andrew.m.higgs
 3 years ago
Best ResponseYou've already chosen the best response.1I don think just commenting will do. Changing the while loop or putting in an if statement to break the while loop is the most likely. Having said that, it its difficult to "fix" the code when we don't really know what the hoped for outcome is.

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0I wasn't sure on this? I assumed that because there was a' %2==0' and an' i/2', it was something to do with even numbers. But what about n? I made it so i printed even numbers 10 down to 2. And n printed odd numbers 3 up to 9....Just as an experiment.

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0I see two possible solutions for the buggy loop: (v1) counts down 'n' to make 10 iterations, while the second (v2) makes 'i' smaller by 1 each time it’s odd, and therefore reaches 0 and breaks the loop.

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0Yes, it runs as an infinite loop the way it is written, and never uses the N = 10 variable. So, you could use the N as a counter to how many times to run the code, or figure out what the code might be trying to do differently. It kind of reminds me of the square root problem discussed in one of the videos.
Ask your own question
Sign UpFind more explanations on OpenStudy
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
 Engagement 19 Mad Hatter
 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.