Solving a Problem with a Single-Subscripted Array: Reading Unique Numbers, Lecture notes of Computer Programming

A solution to read 20 unique numbers between 10 and 100 using a single-subscripted array. The problem statement includes instructions to handle the worst case scenario where all 20 numbers are different. The smallest possible array is used to solve this problem.

Typology: Lecture notes

2012/2013

Uploaded on 04/27/2013

kid
kid 🇮🇳

4.3

(18)

110 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Question 1
Use a single-subscripted array to solve the
following problem. Read in 20 numbers, each of
which is between 10 to 100, inclusive. As each
number is read, print it only if it is not a
duplicate of a number already read. Provide for the
“worst case” in which all 20 numbers are different.
Use the smallest possible array to solve this
problem.

Partial preview of the text

Download Solving a Problem with a Single-Subscripted Array: Reading Unique Numbers and more Lecture notes Computer Programming in PDF only on Docsity!

Question 1

Use a single-subscripted array to solve the following problem. Read in 20 numbers, each of which is between 10 to 100, inclusive. As each number is read, print it only if it is not a duplicate of a number already read. Provide for the “worst case” in which all 20 numbers are different. Use the smallest possible array to solve this problem.