What is the diffrent between while and do while statement ?

Answer Posted / shwetha karkera

In WHILE STATEMENT, the condition is tested first, and then
the statements are executed if the condition turns out to
be true. hence, it is calles as PRE-TESTED LOOPING
CONSTRUCT.

In DO WHILE STATEMENT,the statements are executed for the
first time and then the conditions are tested. if the
condition turns out to be true,then the statements are
executed again.hence it is called as POST-TESTED LOOPING
CONSTRUCT.

SYNTAX FOR WHILE STATEMENT:
while(condition)
{
statement;
}


SYNTAX FOR DO WHILE STATEMENT:
Do
{
statement;
}
while(condition)

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many loops are there in c?

583


Write a c program to demonstrate character and string constants?

1685


I have a varargs function which accepts a float parameter?

580


Write a C program in Fibonacci series.

636


which type of aspect you want from the student.

1703






Explain enumerated types.

600


Explain how can I convert a number to a string?

650


Under what circumstances does a name clash occur?

693


What is the scope of static variables in c language?

631


What is a volatile keyword in c?

638


What is the difference between struct and typedef struct in c?

659


What is indirection?

654


What is the use of ?: Operator?

670


What is meant by int main ()?

719


What are called c variables?

575