Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 106 - 2505_CoreGPT(Podar)_Flipbook_C7
P. 106

    Program 4: To find out the sum of numbers from 1 to 100.

                      Program 5: To find the sum of odd numbers from 5 to 25.

                      While…END...WHILE Statement

                      The WHILE…END...WHILE loop is another looping statement. This loop is used when we do not
                      know the loop count. The FOR...NEXT loop will run for a fixed number of times, but the WHILE

                      loop will run until a given condition remains
                      true.  This  is similar  to telling someone
                      to  keep  doing  a  particular  task  while  the
                                                                                          True     Execute statements
                      condition is true, stop when the condition           Condition?               in the body of the

                      becomes false. WHILE...END...WHILE  loop                                         WHILE loop.
                      is known as a Condition Control loop. The
                                                                          False
                      basic syntax of the WHILE...END...WHILE
                      loop is as follows:                                  Move to the
                                                                        statement after the
                      WHILE (condition is true)
                                                                      END WHILE keyboard
                           Statements to Repeat
                      END WHILE

                    104     Premium Edition-VII

| 101 102 103 104 105 106 107 108 109 110 111 |