while exercises

Exercise
1) Calculate the sum of odd integers for a given upper limit. Also draw flow chart of the program.
2) Calculate the sum of even and odd integers separately for a given upper limit using only one loop structure. Also draw flow chart of the program.

tips:

  • Always use the self explanatory variable names
  • Practice a lot. Practice makes a man perfect
  • While loop may execute zero or more time
  • Make sure that loop test (condition) has an adequate exit.

For previous lesson click here: While Sample Program
For next lesson click here: do-while Statement


the easiest way to learn programming
introduction to programming
while exercises

0 comments:

Post a Comment

 

introduction to programming Copyright © 2011-2012 | Powered by Blogger