Machine Problem 2, due Feb. 23

Part of the homework for CS:2630, Spring 2015
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

Background: The sequence 0, 1, 3, 6, 10, 15, 21 ... is known as the triangular numbers. More formally, t(0)=0, t(1)=1, t(2)=3 ... etc. For any i t(i) gives the number of points in a triangular grid of points that has i points on a side. Wikipedia goes on and on about this sequence if you are curious. Successive members of this sequence can be computed using this recurrance relation:

Assignment: Write an iterative SMAL Hawk main program that computes outputs the first 30 members of this sequence in the following format:

       0       1       3       6      10      15      21

Elements of the sequence are printed in successive 8-space fields, with each element right-justified in its field. Note that calling the Hawk monitor routine putdec(i,8) will print the value i in precisely this format, and note that the Hawk display will automatically wrap long lines of output to the next line, so you need no nothing extra beyond computing the recurrence relation and outputting successive values using putdec().


For full credit:

Submission: Programming assignments will be submitted on-line using the on-line Online Coursework Submission tool provided by the Liberal Arts Linux server cluster. The user interface for this is awful, but but it works. Your source file must be named mp2.a (the name is case-sensitive). This is the name you will type in response to the File/directory name prompt. When the submission tool prompts for Course type cs_2630. Select the assignment directory mp2.

You must submit your work using the submit command from the a CLAS Linux machine. If you make repeated submissions, only the last one will count.