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

0

While Loop

WHILE – WHILE loops are so easy to understand. The Loop will repeated until inside while condition is true.

The basic structure is.
while ( condition )

{ Code to execute while the condition is true }

ExampleWhile Loop:

#include<stdio.h>

#include<conio.h>
void main()
{
int x = 0;
while ( x < 10 )   /* While x is less than 10. in this section can use Boolean statements like (x==1||Y==2)*/

{

printf( “%d\n”, x );
x++;                                                         /* Update x so the condition can be met eventually */
}
getch();
}

Output: 0 to 9

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