Background: |
---|
Your work on Intel assembly language must be assembled and run on Pascal (pascal.mscs.mu.edu).
Assemble your programs on Pascal using the command:
gcc <myfile.S>
Run your programs on Pascal using the command:
./a.outunless you have used the "-o" option to gcc to change the name of your assembled executable.
Few rules govern the format of assembly language programs. Make an effort to keep your programs readable and well-documented; sometimes the professor gives partial credit if he can tell what you were trying to do, even if it doesn't quite make it.
Pascal's Triangle |
---|
Write an assembler program that reads in a single integer from the user and outputs a properly spaced and centered Pascal Triangle of the requested size. Pascal's triangle is a triangular array of numbers (these numbers correspond to the binomial coefficients) whose left and right hand borders are all 1's and where each number is the sum of the two immediately above it. That is:
1 1 + 1 \ / 1 + 2 + 1 \ / \ / 1 + 3 + 3 + 1 \ / \ / \ / 1 4 6 4 1 : :
1 n=0 1 1 n=1 1 2 1 n=2 1 3 3 1 n=3 1 4 6 4 1 n=4 1 5 10 10 5 1 n=5 1 6 15 20 15 6 1 n=6
1 0 0 (n = 4) 0 1 0 (k = 2) ^ | 1 > 0You can see that there is a digit of k that is greater than the corresponding digit of n. Therefore, the number in the position (4,2) is even, which is indeed the case since this number is 6.
The professor has provided an example program for your reference, runnable on Pascal as ~brylow/cosc065/bin/hw9-pascal.
What to turn in: |
---|