Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions