Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started