Determine if the number is odd or even. Add to a counter for each type, i.e. an even counter and an odd counter. Add the number to a sum for each type, i.e. a total of the odd numbers and a total of the even numbers. A value of -999 indicates the end of the array. Your program should end at that point.   The input will be the following variable in your program: L3Array DCD 22,9,333,47,72,128,111,44,-999 The actual number of array entries and their values will be different when your program is graded. The last number will still be -999.

icon
Related questions
Question

The assignment will be similar to an assignment used frequently in CS116 classes.

You will be given an integer array of positive numbers. Your program should process the array and do the following for each entry:

  • Determine if the number is odd or even.
  • Add to a counter for each type, i.e. an even counter and an odd counter.
  • Add the number to a sum for each type, i.e. a total of the odd numbers and a total of the even numbers.
  • A value of -999 indicates the end of the array. Your program should end at that point.

 

The input will be the following variable in your program:

  • L3Array DCD 22,9,333,47,72,128,111,44,-999

The actual number of array entries and their values will be different when your program is graded. The last number will still be -999.

 

The output of your program will be the counts and totals placed in the following variables:

  • L3OddCt DCD 0 ; count of odd numbers
  • L3OddTot DCD 0 ; total of odd numbers
  • L3EvCt DCD 0 ; count of even numbers
  • L3EvTot DCD 0 ; total of even numbers

 

Your program must use the variable names L3Array, L3OddCt, L3OddTot, L3EvCt, and L3EvTot.

The expected results for the array contents shown above are:

  • L3OddCt = 4
  • L3OddTot = 500
  • L3EvCt = 4
  • L3EvTot = 266

 

Your program will be tested with a different set of values in L3Array. The expected output will vary based on that input. Do not assume that the array will contain eight values.

 

Note On File Type

The VisUAL emulator saves files with an extension of ".s".  Please upload your program with that extension, not .cpp, .c, .m, .asm, or any other extension.

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, data-structures-and-algorithms and related others by exploring similar questions and additional content below.