The maximum pairwise product

Report a typo

Write a program that reads N numbers and outputs the maximum pairwise product of the given N numbers (the largest number that can be obtained by multiplying two different elements from the sequence).

If there is only one input element, output this element.

The first line of the input contains the number of elements N.
The following lines contain N numbers, each on a separate line. All the numbers are positive.

Sample Input 1:

2
5
3

Sample Output 1:

15

Sample Input 2:

3
10
2
4

Sample Output 2:

40
Write a program in Kotlin
fun main() {
// write your code here
}
___

Create a free account to access the full topic