C Programing – Idea of Looping Statement (Do While Loop) – Part-3

0

DO..WHILE – DO..WHILE loops

do {
} while ( condition );

If you check carefully above syntax you can found the condition is checked at the end of the block.A do..while loop is same as a while loop except that the loop will be execute at least once. It will execute first then check the condition.

#include <stdio.h>

#include<conio.h>
void main()
{
int x;
x = 0;
do {
printf( “Hello, world!\n” );

x++
}

while ( x != 2 );
getch();
}

Output:

Hello world!

Hello world!

Hello world!

                                ——————– Thanks Everyone

Share.

About Author

Chakraborty Prijus

Former Asst. Manager (IT) - MGH Group MCA (Masters in Computer Application) From Sikkim Manipal University India. Have 5 years experience In IT field.

Leave A Reply

Powered by themekiller.com