DO WHILE LOOPING

DO WHILE LOOP

It is the frequently required that you want the loop to execute at least once as you do with menus and many other application in such condition you should begin with a statement that make a condition true it becomes tedious initializing the variable before each loop. C also provides a type of loop that checks the condition after executing the statements in the loop so you can sure it execute at least once.This sort of loop takes a form that is easy to understand

 

 EXAMPLE:

In the following program we print the alphabets from A to Z by using do while loop. As A to Z is a alphabet so char is used for supposition instead of int.The ch='A' show that it is input value that is shown in the loop .the ch=ch+1 show that it is an increment and after loop while statement is used with condition that condition is a ending point the program is shown as follows

PROGRAM:

OUTPUT:

Comments

Popular posts from this blog

Stack

EXTRA INFORMATION ABOUT TECHNOLOGY