Difference between revisions of "CSC103 2011 Homework 3"
(→Problem #2) |
|||
Line 19: | Line 19: | ||
* Write another program that computes the sum of the integers 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10, and stores the sum in Memory Location 20 (or other convenient location). Your program should stop when it has finished adding the number 10 to Memory Location 20. | * Write another program that computes the sum of the integers 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10, and stores the sum in Memory Location 20 (or other convenient location). Your program should stop when it has finished adding the number 10 to Memory Location 20. | ||
− | + | * Make your program store the ten numbers 1, 2, 3, ... 10 in 10 memory locations, and add them up to compute the sum | |
− | * | ||
− | |||
− | |||
− | |||
* Your program '''should''' stop automatically when it is done. | * Your program '''should''' stop automatically when it is done. | ||
<br /> | <br /> | ||
+ | * As with Problem 1, copy your solution to a piece of paper that you will submit on the 21st, at 9:00 a.m. | ||
− | * | + | =Problem #3= |
+ | |||
+ | * Same as Problem #2, but without storing the ten numbers in memory. The program should generate all the numbers required in the accumulator, and use only 1 memory location to store data. | ||
+ | * As with Problem #2, copy your solution to a file | ||
<br /> | <br /> |
Revision as of 21:05, 14 February 2011
This homework is due on Monday, Feb. 21st, at 9:00 a.m. You should make sure that you have gone through all the steps of Lab #3 as preparation for this homework.
Contents
Problem #1
- Use the Processor/Memory simulator and write a program that starts with 4 numbers stored in memory Locations 14, 15, 16, 17, and that stores the sum of all 4 in memory Location 18.
- When you program works correctly, transcribe it on a piece of paper which you will submit as the solution to this homework.
Problem #2
- Write another program that computes the sum of the integers 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10, and stores the sum in Memory Location 20 (or other convenient location). Your program should stop when it has finished adding the number 10 to Memory Location 20.
- Make your program store the ten numbers 1, 2, 3, ... 10 in 10 memory locations, and add them up to compute the sum
- Your program should stop automatically when it is done.
- As with Problem 1, copy your solution to a piece of paper that you will submit on the 21st, at 9:00 a.m.
Problem #3
- Same as Problem #2, but without storing the ten numbers in memory. The program should generate all the numbers required in the accumulator, and use only 1 memory location to store data.
- As with Problem #2, copy your solution to a file