note that in the while loopthe condition is tested before any of the statements in the statement block is executed if the condition is trueonly then the statements will be executedotherwise if the condition is falsethe control will jump to statement ythat is the immediate statement outside the while loop block in the flow diagram of fig it is clear that we need to constantly update the condition of the while loop it is this condition which determines when the loop will end the while loop will execute as long as the condition is true note that if the condition is never updated and the condition never becomes falsethen the computer will run into an infinite loop which is never desirable for examplethe following code prints the first numbers using while loop #include int main(int while( <= printf("\ % " ) /condition updated return note that initially and is less than the condition is trueso in the while loop the value of is printed and its value is incremented by when = the condition becomes false and the loop ends programming example write program to calculate the sum of numbers from to #include int main(int nmisum = printf("\ enter the value of ")scanf("% "& ) =mprintf("\ enter the value of ")scanf("% "& )while( <=nsum sum ii printf("\ the sum of numbers from % to % % "mnsum)return output enter the value of enter the value of the sum of numbers from to do-while loop the do-while loop is similar to the while loop the only difference is that in do-while loopthe test condition is tested at the end of the loop as the test condition is evaluated at the endthis means that the body of the loop gets executed at least one time (even if the condition is falsefigure shows the syntax and the general form of do-while loop