QuestionQuestion

1. Explain the difference between the uses for the control structure if and the control structure while.

2. Explain the difference between count controlled and sentinel loops. Give an example of each.

3. Solve the following exercises using a while loop. Write a small code snippet meaning you do not need to include libraries, or mention the main function. It is recommended to test your output on the computer.

a) Generate a loop to produce the following text:
1…
2…
3…
4…
5…
Done!

b) Generate a loop to produce the following text:
5...
4…
3…
2…
1…
Happy New Year?

c) Generate a loop to produce the following text:
0…
3…
6…
9…
12…
15…

d) Prompt the user to solve the equation “(17 – 3) * 9”, if the user does not enter the correct value, 126, prompt the user to try again and enter another value. Continue to do this until the user has entered the correct value.

e) Write a loop to implement the following equation.
sum=∑ (i=1)ⁿ 1/i²

f) Write a loop that converts feet to meters. The program should display feet from 3 to 30 in 3-foot increments and the corresponding meter equivalents. Use the relationship that 1 meter = 3.28 feet.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

1. Explain the difference between the uses for the control structure if and the control structure while.
The different is that the program runs through if block one time only. It will go back to the while condition after reaching the end of the control structure when the condition is still true

2. Explain the difference between count controlled and sentinel loops. Give an example of each.
In sentinel loops, the counter must be increased or reduced by each loop
In count controlled loops, the counter can be decided whether it should be increased, reduced or unchanged at each loop...
$20.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Visual Basic Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats