Important Notice:

Course Content
Building IoT Applications (Chapter-4) M4-R5.1
About Lesson

While Loop

             The while loop is an entry controlled loop statement, i.e means the condition is evaluated first and it is true, then the body of the loop is executed. After executing the body of the loop, the condition is once again evaluated and if it is true, the body is executed once again, the process of repeated execution of the loop continues until the condition finally becomes false and the control is transferred out of the loop.

 

while loop can be addressed as an entry control loop. It is completed in 3 steps.

Variable initialization.( e.g int x=0; )

condition( e.g while( x<=10) )

Variable increment or decrement ( x++ or x– or x=x+2 )

Syntax :

 variable initialization ;

while (condition)

{

statements ;

variable increment or decrement ;

}

 

1 Program to print first 10 natural numbers

2 C Program to reverse number

Practical Exercise:- Click Here

error: Content is protected !!