Min and Max Functions

Understand two overloaded min( ) and max( ) functions.

Challenge

Write a program that provides an overloaded max() function that receives either an array of integers or an array of doubles and returns the maximum value from the array. On similar lines, write the overloaded min() function.

Sample run

Minimum of Integer Array: 1
Minimum of Double Array: 1.4
Maximum of Integer Array: 7
Maximum of Double Array: 6.9

Coding exercise

Try to solve this challenge on your own. If you can’t solve it, you can look at the solution and explanation below.

Get hands-on with 1200+ tech skills courses.