Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested Loop Help

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Here's what I have so far:

Move #LIST,R0
Clear R1
Clear R2
Clear R3
Move N,R4
Add 4(R0),R1
Add 8(R0),R2
Add 12(R0),R3
Add #16, R0
Decrement R4
Branch>0 LOOP
Move R1, SUM1
Move R2, SUM2
Move R3, SUM3

No this works for when I have a set amount of different SUMS but I'm trying to make it so that I do not know the amount of SUMS there will be. I'm trying to assume an unkown say j.

I realize I need 2 nested loops but not sure how to set them up.

Any advice on this? Need me t explain better?
 
Assume there are n students.
Assume that j is stored in memory location J, placed ahead of location N
Write a program for computing sums of the scores on each test and store these sums in the memory word locations at addresses SUM, SUM +4, SUM +8, .... The number of tests, j, is larger than the number of registers in the processorer.

So the type of program I've written for the 3-test case cannot be used.

I need to use two nested loops. The inner loop should accumulate the sum for a particular test, and ***** outer loop should run over the number of tests, j.

Does that help???


 
Assume there are n students.
Assume that j is stored in memory location J, placed ahead of location N
Write a program for computing sums of the scores on each test and store these sums in the memory word locations at addresses SUM, SUM +4, SUM +8, .... The number of tests, j, is larger than the number of registers in the processorer.

So the type of program I've written for the 3-test case cannot be used.

I need to use two nested loops. The inner loop should accumulate the sum for a particular test, and ***** outer loop should run over the number of tests, j.

Does that help???


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top