Welcome to AssignmentCache!

PRG 211 Week 4 Labs

Availability: In stock

$12.00

Quick Overview

PRG 211 Week 4 Labs


Lab 9.1 Output numbers in reverse


Write a program that reads a list of 10 integers, and outputs those integers in reverse. For coding simplicity, follow each output integer by a space, including the last one. Then, output a newline.


Ex: If the input is 2 4 6 8 10 12 14 16 18 20, the output is:
20 18 16 14 12 10 8 6 4 2
To achieve the above, first read the integers into an array. Then output the array in reverse.



Lab 9.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 (a negative indicates 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: Use an array of size 9. First read the data into an array. Then, based on the number of items, find the middle item.



Lab 9.3 Output values below an amount


Write a program that first gets a list of 5 integers from input. Then, get another value from the input, and output all integers less than or equal to that value.


Ex: If the input is 50 60 140 200 75 100, the output is:
50 60 75
For coding simplicity, follow every output value by a space, including the last one. Then, output a newline.


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

PRG 211 Week 4 Lab 9.2 Middle item Program

Double click on above image to view full picture

Zoom Out
Zoom In

More Views

  • PRG 211 Week 4 Lab 9.2 Middle item Flowchart
  • PRG 211 Week 4 Lab 9.2 Middle item Program
  • PRG 211 Week 4 Lab 9.3 Output values below an amount Flowchart
  • PRG 211 Week 4 Lab 9.3 Output values below an amount Program
$12.00

Details

PRG 211 Week 4 Labs

Lab 9.1 Output numbers in reverse

Write a program that reads a list of 10 integers, and outputs those integers in reverse. For coding simplicity, follow each output integer by a space, including the last one. Then, output a newline.

Ex: If the input is 2 4 6 8 10 12 14 16 18 20, the output is:
20 18 16 14 12 10 8 6 4 2
To achieve the above, first read the integers into an array. Then output the array in reverse.


Lab 9.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 (a negative indicates 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: Use an array of size 9. First read the data into an array. Then, based on the number of items, find the middle item.


Lab 9.3 Output values below an amount

Write a program that first gets a list of 5 integers from input. Then, get another value from the input, and output all integers less than or equal to that value.

Ex: If the input is 50 60 140 200 75 100, the output is:
50 60 75
For coding simplicity, follow every output value by a space, including the last one. Then, output a newline.

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

Additional Information

Special Price $9.00

Product Tags

Use spaces to separate tags. Use single quotes (') for phrases.

[profiler]
Memory usage: real: 18350080, emalloc: 17996736
Code ProfilerTimeCntEmallocRealMem