Explain the do - while statement - computer programming, Programming Languages

Assignment Help:

Explain the Do - While Statement - Computer Programming?

A do - while loop is an exit controlled loop and the body of the loop gets executed at least once if the condition is not satisfied.

The universal form is

            do

            {

                        statements;

            }

            while(expression);

While the control reaches the do statement the program proceeds to evaluate the body of the loop first At the end of the body of the loop first and At the end of the body of the loop the while statement is evaluated. If the condition is true after that the body of the loop will be executed again. This will go on until the condition becomes false.

This is very alike to the while loop except that the test occurs at the end of the loop body. This guarantees that the loop is executed at least once before continuing. Such a setup is often used where data is to be read. The test after that verifies the data, and loops back to read again if it was unacceptable.

do

{      

printf("Enter 1 for yes, 0 for no :");

                        scanf("%d", &input_value);

}

while (input_value != 1 && input_value != 0);


Related Discussions:- Explain the do - while statement - computer programming

Simple encryption, i have to make a program that encrypt a text to numbers,...

i have to make a program that encrypt a text to numbers, i don''t know what is wrong in my code, the example of what i need: text: hi >> number: 17 23

Java.., create a program that can determine the number of students that are...

create a program that can determine the number of students that are doing their final year for a particular program (e.g. BCOM Information Systems), calculate the required credits

Memory hierarchy for linux systems, Memory Hierarchy for Linux Systems ...

Memory Hierarchy for Linux Systems A cache line has one or more valid bit(s), tag entry and list of bytes in a block in one set of a cache, as shown below: If you were

Shell script to print right traingle, Normal 0 false false ...

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Java string handling, Expertsmind brings you unique solution in java assig...

Expertsmind brings you unique solution in java assignments String Handling Series signifies a sequence of character types. It has set duration of personality sequence. Onc

What is the switch statement, What is the switch Statement? This is a dif...

What is the switch Statement? This is a different form of the multi way decision that It is well structured, but can only be used in certain cases where: 1. Here, Only one var

Temperature Calculation system, Detailed Description: • The program will t...

Detailed Description: • The program will take temperature readings as input from user for specified number of consecutive days. • Program will store these temperature values into

Animals, Let us say we have a list of 10 animal objects called "animals" in...

Let us say we have a list of 10 animal objects called "animals" in Alice. Write the code to move them forward synchronously by 1 meter.

Calculate the total price to purchase all the components req, Calculate the...

Calculate the total price to purchase all the components required to build a state-of-the-art gaming computer from components available on the internet. Before attempting this exer

Service oriented architectures in xml, question 1: In the opening lecture I...

question 1: In the opening lecture I spoke about general changes in business - flatter organizations, process orientation as opposed to functional silos, focus on supply chains, gr

Write Your Message!

Captcha
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