99.5k views
2 votes
Use HLA in ASSEMBLY LANGUAGE.not c++,c and java.

Write a program to read numbers. The program counts the items read, calculates the total, the maximum and minimum of the numbers.
The program stops when a zero is entered.
Zero will not be part of data.
Enter a positive number, to stop: 45 Enter a positive number, to stop: 345 Enter a positive number, o to stop: 9834 Enter a positive number, to stop: 1290 Enter a positive number, to stop: 20 Enter a positive number, to stop: 32 Enter a positive number, to stop: 567 Enter a positive number, o to stop: 93 Enter a positive number, to stop: 999 Enter a positive number, to stop: 1205 Enter a positive number, o to stop: 0 Total: 14430 Count: 10 Maximum: 9834 Minimum: 20

1 Answer

2 votes

Final answer:

To write a program in HLA (Assembly Language) to count the items read, calculate the total, maximum, and minimum of the numbers, you can follow these steps:

  1. Declare variables to store the count, total, maximum, and minimum values.
  2. Initialize the count to 0, total to 0, maximum to the smallest possible value, and minimum to the largest possible value.
  3. Start a loop to read numbers from the user until a zero is entered.
  4. Inside the loop, use the `ReadInt` function to read an integer from the user.
  5. Check if the entered number is zero. If it is, break out of the loop.
  6. Increment the count by 1.
  7. Add the entered number to the total.
  8. Check if the entered number is greater than the current maximum. If it is, update the maximum value.
  9. Check if the entered number is less than the current minimum. If it is, update the minimum value.
  10. Repeat steps 4-9 until a zero is entered.
  11. Display the total, count, maximum, and minimum values to the user.

Here is an example program in HLA (Assembly Language) that implements the above steps:program CountMinMax;

User Dikuw
by
8.6k points