Difference between revisions of "CSC231 Loop Exercises"

From dftwiki3
Jump to: navigation, search
(Exercise 3)
(Exercise 3)
Line 41: Line 41:
 
<br />
 
<br />
 
<onlydft>
 
<onlydft>
 
+
=Possible Solutions=
 
<source lang="asm">
 
<source lang="asm">
 
;;; printStars.asm
 
;;; printStars.asm

Revision as of 08:18, 10 October 2012

--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.









...