Question: Write a program to find the greatest number in an entered sorted array, which is a product of two elements of an entered array. The

 Write a program to find the greatest number in an entered

sorted array, which is a product of two elements of an entered

Write a program to find the greatest number in an entered sorted array, which is a product of two elements of an entered array. The output should be print resulted number, if such number is exist otherwise print -1 . Note: The range of elements of an array should be 1 to 105 and array should be sorted. Coding Window limport java.util.*; - class GreatestNum \{ static int findGreatest(int arr[], int n ) \{ //write your code here \} public static void main(String[] args)\{ GreatestNum obj = new GreatestNum(); Scanner in = new Scanner(System.in); int n=in.nextInt(); int arr[]= new int[n]; for(int i=0;i

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