{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Week 3 DQ 2 - ages Declare Name As String Declare Age As...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Write a 200- to 300-word short-answer response to the following questions: What is an iteration structure? What problem does a repetition structure solve? Provide an example of a process in which a repetition structure is appropriately used. An iteration structure is basically a loop. It is used when you want a block of code to run more than once. For example, if you would like to get a series of numbers to calculate to get the average of the numbers in one program. The problem that repetition structure solve are: instead of just one number you can use any amount that you need to, the number can be very large, you can repeat it 10 times, 100 times or more without changing the code, like calculating grades for the whole class, and you can repeat an action while a certain situation is true (or until its false) for example, asking the user for their choice. This is an example of a loop that will ask the user the name of their brother or sister and their
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ages. Declare Name As String Declare Age As Integer Repeat Write "Enter the name of your brother or sister: " Input Name Write Name Write “Enter the age of “ Name: Input Age Write Age Until Name == "Done" Question to all What is an "Infinite loop"? Write an example of pseudocode using "Repetition Structures" that generates an infinite loop An infinite loop is a loop that has a condition that is not met, so it causes the loop to continue to run and not exit. Declare Number, Total As Integer Repeat Write "Please enter a number: " Input Number Total = Number + 1 Write Number Until Number == “0” Question to all To illustrate the difference between assignment operator (=) and comparison operator (==), do the followings. . Create a one line of programming code for each type of operator Comparison operator: IF age is more than 18, THEN write "I can vote" Assignment operator: My age is 19. IF Age > 18 Then Write "I can vote" Let Age = 19...
View Full Document

{[ snackBarMessage ]}

Page1 / 2

Week 3 DQ 2 - ages Declare Name As String Declare Age As...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online