Question: Write a program that reads a list of integers, and outputs the two smallest integers in the list, in ascending order. The input begins with

Write a program that reads a list of integers, and outputs the two smallest integers in the list, in ascending order. The input begins with an integer indicating the number of integers that follow.
Ex: If the input is:
5
1053212
the output is:
2 and 3
You can assume that the list of integers will have at least 2 values.
To achieve the above, first read the integers into an array.
Hint: Make sure to initialize the second smallest and smallest integers properly

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!