Looping Exercises

From WLCS
Revision as of 14:30, 21 November 2008 by Admin (talk | contribs) (New page: '''Objective:''' * To become well-learned in the way of the while loop '''Directions:''' * For each of the following sequences, first prompt the user for a number N and print out the firs...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Objective:

  • To become well-learned in the way of the while loop

Directions:

  • For each of the following sequences, first prompt the user for a number N and print out the first N terms of the sequence
  • Creating functions for the following exercises is optional
  • Powers of 3
    • 1, 3, 9, 27, 81, ...
  • Fibonacci Sequence
    • 1, 1, 2, 3, 5, 8, 13, 21, ...
  • Factorial Sequence
    • 1, 1, 2, 6, 24, 120, ... (HINT: using nested loops might help)