Given an array of positive even and odd numbers. We have to find the index of largest even number. Use that maximum even number | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Given an array of positive even and odd numbers. We have to find the index of largest even number. Use that maximum even number

Input Test Case: An array of positive even and odd numbers 7 3 5 4 13 11 21 Output Test Case: A Number. 64

15th Nov 2018, 3:36 PM
Abrar Bandar
Abrar Bandar - avatar
3 Answers
+ 15
well , I noticed that output is sum of array elements 😃 Anyways by seeing the question , it looks like u need to find largest even number in the array , so idea for it 1)make duplicate array of it ,sort it using Arrays.sort(); 2)then start from last index & go in beginning , whenever even number come it is the largest , check by %2==0 3)then go in original array & find the index of that element //simple ☺👍 , other solution also exists .
15th Nov 2018, 4:30 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 5
The most interesting part of the OP's request is the chosen tags for covering 3 different languages which makes it even worse! Like a hunter who is hunting all kinds of animals and collecting their heads for his collection! C++ Java C It really reveals the lack of a goal, being in a rush to prepare the assignment, and being carefree about the outcome of his work.
15th Nov 2018, 3:53 PM
Babak
Babak - avatar
+ 3
Beside being unclear your output (for me), where is your attempt?
15th Nov 2018, 3:39 PM
KrOW
KrOW - avatar