Difference between revisions of "CSC103 2011 Homework 3"
(Created page with "<center> <font size="+2">Page under construction!</font> <br \>300px </center>") |
|||
Line 3: | Line 3: | ||
<br \>[[File:UnderConstruction.jpg|300px]] | <br \>[[File:UnderConstruction.jpg|300px]] | ||
</center> | </center> | ||
+ | |||
+ | <br /> | ||
+ | <bluebox>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 [[CSC103_2011_Lab_3| Lab #3]] as preparation for this homework.</bluebox> | ||
+ | <br /> | ||
+ | __TOC__ | ||
+ | <br /> | ||
+ | =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. | ||
+ | |||
+ | * You are free to write the program in one of two different ways: | ||
+ | *#The first option is to store the ten numbers 1, 2, 3, ... 10 in 10 memory locations, and add them up to compute the sum, or | ||
+ | *# write a loop that adds the 10 numbers by computing them and storing the sum in Memory Location 20. | ||
+ | |||
+ | * 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. | ||
+ | |||
+ | |||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | [[Category:CSC103]][[Category:Homework]] |
Revision as of 21:00, 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.
- You are free to write the program in one of two different ways:
- The first option is to store the ten numbers 1, 2, 3, ... 10 in 10 memory locations, and add them up to compute the sum, or
- write a loop that adds the 10 numbers by computing them and storing the sum in Memory Location 20.
- 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.