Write an algorithm that outputs the smallest and second


Using the following Array,

S = { -55.985, 14.75, .00049, 35.42, -.00049, 883.03, 19.03 }

use code (the language of your choice) to write a program to do the following Exercises

Problem 2 : Write an algorithm that returns the smallest value in the array. Use a for loop

Problem 3: Write an algorithm that outputs the largest ans second largest values in the array.

Problem 4s : Write an algorithm that outputs the smallest and second smallest values in the array.

Problem 5: Write an algorithm that outputs the smallest and largest values in the array.

When you write your program, you can let one program do all of the problems (as opposed to writing four separate programs) by using a separate function/method to handle each of the problems listed above (e.g., a method named "probFour( )" to do Exercise 4s, and a method named "probThree()" to do problem 3, etc.)

Program Output:

Have your program output the answers as follows:

Answer to Problem 2: blah, blah

Answer to Problem 3: blah, blah

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Write an algorithm that outputs the smallest and second
Reference No:- TGS01246079

Now Priced at $20 (50% Discount)

Recommended (97%)

Rated (4.9/5)