|
|
|
|
||||
|
The output of the program is:
While construct is a very elegant and powerful
construct. We have seen that it is very easy to sum first 1000 integers just with
three statements. Suppose we have to calculate the sum of first 20000
integers. How can we do that? We just have to change the condition in the
while loop (i.e. number <= 20000). |
||||||
|
|
Previous |
TOC |
Next |
|||