Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 124 - 2609_Logicode
P. 124

    On running the above program, you will get the following output:

                      THE WHILE LOOP

                      The while loop executes a set of statements repeatedly, until the logical expression evaluates to
                      false. When the condition becomes false, the control comes out of the loop. The syntax of while
                      statement is given below:

                      while (test expression):
                             Statements
                             increment/decrement expression
                      Program: To print first 5 natural numbers using while loop.

                      On running the above program, you will get the following output:

                      122   Premium Edition-VIII

| 119 120 121 122 123 124 125 126 127 128 129 |