SORT8
QUESTION DESCRIPTION
Given an array with all elements greater than or equal to zero.Return the maximum product of two numbers possible.
Input:
The first line of input contains an integer T denoting the number of test cases.
The first line of each test case is N, N is size of array.
The second line of each test case contains N input A[i].
Mandatory method for this program is "void sort(int a[],int n)"
Output:
Print the maximum product of two numbers possible.
Constraints:
1 ≤ T ≤ 20
1 ≤ N ≤ 50
0 ≤ A[i] ≤ 1000
Given an array with all elements greater than or equal to zero.Return the maximum product of two numbers possible.
Input:
The first line of input contains an integer T denoting the number of test cases.
The first line of each test case is N, N is size of array.
The second line of each test case contains N input A[i].
Mandatory method for this program is "void sort(int a[],int n)"
Output:
Print the maximum product of two numbers possible.
Constraints:
1 ≤ T ≤ 20
1 ≤ N ≤ 50
0 ≤ A[i] ≤ 1000
TEST CASE 2
INPUT
INPUT
2
6
4 8 9 21 1 7
5
42 1 92 12 17
OUTPUT189
3864
#include <iostream>
using namespace std;
int main() {
int n,t,temp,i,j;
cin>>n;
cin>>t;
int arr[t];
while(t--)
{
cin>>arr[t];
for(i=0;i<=t;i++)
{
for(j=i+1;j<=t;j++)
{
if(arr[i]>arr[j])
{
temp=arr[i];
arr[i]=arr[j];
temp=arr[j];
}
}
cout<<arr[j];
}
}
return 0;
}
Comments
Post a Comment