What is the difference between a while loop and a do while

Assignment Help C/C++ Programming
Reference no: EM13858181

1. What is the difference between a while loop and a do..while loop?

2. Every switch statement can be rewritten as a series of nested if statements. Is the reverse true? Give an example of a set of nested loops that could not be implemented as a switch statement?

3. State what output, if any, results in each of the following code segments, use a trace table to show the execution of the loops:

int i=5;

int sum = 0;

while (i>=0){

sum = sum + i 2; i--;

System.out.println(sum);

b. int x, y;

do

System.out.println(x , " + y); x=x+1;

while (x<y); System.out.println(x + " " + y);

SycstefV.oluntt.pirin't((ii'5-5)--V(*** ");

}

System.out.println();

fc.(1 = i; <= 3; I-'){ System.out.print("*");

System.out.println();

4. Rewrite the while loop in question 3a as a for loop AND rewrite the for loop in question 3c as a while loop

Reference no: EM13858181

Questions Cloud

Explain swot analysis of the product : Technology used and the current state of technologies when the product was introduced. SWOT analysis of the product. Primary reason for the product's failure
How the director uses camera shots and framing : How the director uses camera shots and framing, etc. generally. And how the director uses different shots and faming to show body language.
Describe the different types of computer attacks : Describe the different types of computer attacks
Show that the set s is convex : Show that the set S = {x  ∈ Rn : aTx = b} is convex and show that the set S = {x E Rn : aTx > b} is convex.
What is the difference between a while loop and a do while : Every switch statement can be rewritten as a series of nested if statements. Is the reverse true? Give an example of a set of nested loops that could not be implemented as a switch statement?
What changes will you make in future quarters : What is the North American Industry Classification System (NAICS) for Minnesota Micromotors, Inc. (MM) playing the role of the Marketing Manager in a marketing simulation for Minnesota Micromotors, Inc. (MM). What changes will you make in future qu..
What would be the dft frequency-domain sample spacing in hz : What would be the DFT frequency-domain sample spacing in Hz if the N-sample X(n) time sequence was padded with 4N zero-valued samples and we performed a DPT on that extended-time sequence
Selecting a benchmark company : The National Semiconductor Corporation (NSM) develops and manufactures semiconductors for electronic systems. The firm's products are used in a variety of applications, including LED lighting, high speed communication, renewable energy, and securi..
Organization success story of growth and calls : This week's assignment is on an organization's success story of growth and calls for us to do the following: Select a successful 21st century global organization for the discussion

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a program the contains an array of 1000 elements name

Write a function named equals() that accepts two char arrays and return true if both arrays have the same characters in the same order. The function should return false otherwise. Write a simple main() function to test your function.

  Calculate the volume flow rate in cubic feet

Write a program to calculate the volume flow rate in cubic feet per second of water flowing through a pipe of diameter d in inches and a velocity of v feet per second. The formula for the flow rate is given by: Where area = ?d^2 / 4 equation in sq..

  Main program should instantiate an instance

The main program should instantiate an instance of the class Rectangle and then make calls to the member functions to input the data and output the results

  Create a simple home utility auditing program.

Design, implement, test, and debug a Visual Basic® program to create a simple home utility auditing program.

  Write a recursive definition in sml to reverse

Write a recursive definition in SML to reverse a list of elements and multiply all elements with 2.

  Your project must use and demonstrate understanding

Your project must use and demonstrate understanding of:a. Variables b. Loops c. Decision statements d. File I/O e. Screen output f. Keyboard input g. Functions h. Arrays i. Searching and sorting j. Classes k. Objects l. Methods

  Preparing a high level language program

Describe the purpose of each step in preparing a high level language program for execution (editing, compiling, linking, and loading).  Include in your description the types of files created with each of the first three steps.?

  The "continue" and "break" statements

How are the "continue" and "break" statements different from the "exit" and "return" statements?

  Calculate and return the average of one of numerical values

Write a method that uses the array to output to the console the list of entries in reverse order. Each entry is displayed on a new line.

  C++ essay & coding

Create codes for the following problem/s. Compile, test run, and edit them if necessary. Include your original .cpp and related file(s) (if any) in a single folder. Compress (zip) the folder and submit the single zipped folder.

  Calculate the integer square root by calculating

Calculate the integer square root by calculating

  Write a program that uses the following arrays empid an

write a program that uses the following arrays empid an array of seven long integers to hold employee identification

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd