Question: C programming very beginner coding. I learned how to make a program using c language to find smallest number. However, can you make a program

C programming very beginner coding.

I learned how to make a program using c language to find smallest number.

However, can you make a program finding not only the smallest number but also the second smallest number as well?

For an example: I will type 5 numbers (using stdin) such as: 13 25 37 8 10

then the program finds the smallest number and second smallest number then response as: "smallest number is 8 and second smallest number is 10." then exit.

Also, 2 more conditions in case I don't type 5 numbers.

1) if I type nothing for all of 5 numbers (just pressing enter key for stdin, I guess?), then let it response as: "You need to type numbers." then exit.

2) if I type only one number such as 10 and type nothing for rest of other 4 numbers, then let it response as: "There is only one number. so, the smallest number is 10." then exit.

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 Programming Questions!