CSC231 Loop Exercises

From dftwiki3
Revision as of 08:21, 10 October 2012 by Thiebaut (talk | contribs)
Jump to: navigation, search

--D. Thiebaut 11:21, 20 October 2010 (UTC)


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.









...