 # Output values below an amount

(LAB 1) Output numbers in reverse

Write a program that reads a list of integers, and outputs those integers in reverse. The input begins with an integer indicating the number of integers that follow. For coding simplicity, follow each output integer by a space, including the last one. Assume that the list will always contain fewer than 20 integers.

Don't use plagiarized sources. Get Your Custom Essay on
Output values below an amount
Just from \$13/Page

Ex: If the input is:

``5 2 4 6 8 10``

the output is:

``10 8 6 4 2``

To achieve the above, first read the integers into an array. Then output the array in reverse.

(LAB 2) Middle Item

Given a sorted list of integers, output the middle integer. Assume the number of integers is always odd.

Ex: If the input is:

``2 3 4 8 11 -1 ``

(where a negative indicates the end), the output is:

``4``

The maximum number of inputs for any test case should not exceed 9. If exceeded, output “Too many inputs”.

Hint: First read the data into an array. Then, based on the array’s size, find the middle item.

(LAB 3) Output values below an amount

Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, which indicates a threshold. Output all integers less than or equal to that last threshold value. Assume that the list will always contain fewer than 20 integers.

Ex: If the input is:

``5 50 60 140 200 75 100``

the output is:

``50 60 75``

The 5 indicates that there are five integers in the list, namely 50, 60, 140, 200, and 75. The 100 indicates that the program should output all integers less than or equal to 100, so the program outputs 50, 60, and 75.

For coding simplicity, follow every output value by a space, including the last one.

Such functionality is common on sites like Amazon, where a user can filter results.

(LAB 4) Adjust list by normalizing

When , such as data for human heights or for human weights, a common step is to adjust the data. This can be done by normalizing to values between 0 and 1, or .

For this program, adjust the values by subtracting the smallest value from all the values. The input begins with an integer indicating the number of integers that follow. Assume that the list will always contain fewer than 20 integers.

Ex: If the input is:

``5 30 50 10 70 65``

the output is:

``20 40 0 60 55``

The 5 indicates that there are five values in the list, namely 30, 50, 10, 70, and 65. 10 is the smallest value in the list, so is subtracted from each value in the list.

For coding simplicity, follow every output value by a space, including the last one.

(LAB 5) Word Frequencies

Write a program that reads a list of words. Then, the program outputs those words and their frequencies. The input begins with an integer indicating the number of words that follow. Assume that the list will always contain fewer than 20 words.

Ex: If the input is:

``5 hey hi Mark hi mark``

the output is:

``hey 1``

error: Content is protected !!
Need assignment help? You can contact our live agent via WhatsApp using +1 718 717 2861

Feel free to ask questions, clarifications, or discounts available when placing an order.

Order your essay today and save 30% with the discount code LOVE