Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Write a program that asks the user what he wants the sentinel to be
- enter numbers until the sentinel is entered.--do not save the entered numbers
- output the sum of all the positive numbers
- the sum of all the negative numbers
- how many positive numbers were entered
- how many negative numbers were entered
- how many zeros were entered
- output if the most "type" of numbers is positive, negative or zero
- do not need to check for an invalid sentinel
- may assume the counts for positive, negative, and zero will all be different.]
- if you check for an invalid sentinel, and check for "types" being the same you will get extra credit-remember any 2 may be the same, all 3 may be the same
- use only instructions we've done in class (add, addi, sub, subi, move, li, la, syscall, all forms of branch, jump). no functions
- name your file firstInitianLastNameP1.asm or it will not be graded (my file would be named ELichtenthalP1.asm)
- if you use an incorrect name, or instructions we haven't done as of today, it will not be graded.
- be sure to comment
- 1) Prompt user for sentinel value
- 2) Store that in t0.
- 3) Begin loop.
- a) prompt user for integer value
- b) check for sentinel, if sentinel, break (if $v0 = t0)
- c) store it in t3
- d) If t3>0 add 1 to s0, if t2<0 add 1 to s1, if t2 = 0 add 1 to s2.
- e) If t3>0 add it to t1, if t3<0 add it to t2.
- f) Set t3 = 0.
- g) go back to the start of the loop
- 4) Output
- a) Output sums
- b) Output counters
- c) Comparison
- i) Compare positive and negative, if positive go to ii, else go to iii
- ii) compare positive and zeroes, output
- iii) compare negative and zeroes, output
- 5) Terminate
Advertisement
Add Comment
Please, Sign In to add comment