CSC231 Loop Exercises

From dftwiki3
Revision as of 11:07, 15 September 2008 by Thiebaut (talk | contribs) (New page: Back to CSC231 Schedule ---- =Exercise 1= Review. Write a simple program that prints a line of 30 stars ****************************** =Exercise 2= Using a ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Back to CSC231 Schedule


Exercise 1

Review. Write a simple program that prints a line of 30 stars

******************************

Exercise 2

Using a loop, write a simple program that prints 30 lines of stars, such that the first line contains 30 stars, the next one 29 stars, then 28 stars, until the last line printed contains only 1 star.

******************************
*****************************
****************************
***************************
**************************
*************************
************************
***********************
**********************
*********************
.
.
.
***
**
*

Exercise 3

Same exercise, but this time the first line printed contains 1 star, the next 2 stars, and so on until the last one, which contains 30 stars.