Can anyone do me the java programming for finding the minimum value and its index in an array | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

Can anyone do me the java programming for finding the minimum value and its index in an array

It should be java or python

9th Dec 2021, 12:53 PM
satish kumar
satish kumar - avatar
12 Answers
0
a = [10, 40, 100, 48, 500, 900, 20, 5, 300] b = min(a), a.index(5) print(b) I used python to code it, I don't know whether the way you like it or not. But am sure you can manage it and get some ideas in it.
11th Dec 2021, 11:12 AM
Muhammad Abdulmalik
Muhammad Abdulmalik - avatar
+ 11
Amirreza Hashemi , you are showing a really nice code (*1) to help someone solving a task. we all appreciate this very much!  (this is my personal statement - but it is not to criticize someone !!) but there is an issue by giving a ready solution, when the op has not done and shown his attempt first. as a part of the community i believe that learning by doing is more helpful, than just using a shared or ready solution. we should act more as a mentor. it is a very successful way when we are giving hints and help, so that the op is able to solve his task by himself. BTW (*1): i assume that the op is level 5 with 6% of the python core tutorial done. this requires a code that the op can understand. so we should not show what we are able to do, but a way that is helpful for the op. if he can not understand the code, he probably will copy and paste it, without having any real benefits. thanks for your understanding and your support!
9th Dec 2021, 3:07 PM
Lothar
Lothar - avatar
+ 4
Show your attempt
9th Dec 2021, 12:54 PM
MATOVU CALEB
MATOVU CALEB - avatar
+ 3
Just try to implement what you know. We are always there for you
9th Dec 2021, 12:58 PM
Atul [Inactive]
+ 2
Amirreza Hashemi "However, it is important to note that members should not post answers to course quizzes without also providing a proper explanation of how the answer was obtained. These ‘answer-only’ comments are considered unhelpful in terms of promoting the acquisition and retention of programming knowledge among learners and will subsequently be removed by our moderation team." https://www.sololearn.com/Content-Creation-Guidelines/ (This is from the section on course comments, but the principle should be the same for Q&A.)
9th Dec 2021, 7:00 PM
Simon Sauter
Simon Sauter - avatar
+ 2
As a java programmer, I can suggest iterating through each element in the array and assigning the smallest value(int or double) to a variable (int min or double min) and the index of the minimum value to another variable.
10th Dec 2021, 8:57 PM
HydroShock
HydroShock - avatar
+ 1
Mhm
9th Dec 2021, 7:46 PM
Amirreza
Amirreza - avatar
+ 1
At least show your try, people here would surely help you. To be honest, everyone might feel the same at the start. But try to show us your try. Then say what you want to say, so others will understand and fix your code.
11th Dec 2021, 11:14 AM
Jonathan P. Jundarino
Jonathan P. Jundarino - avatar
0
I got in an interview exam I didn't answer that's why
9th Dec 2021, 12:55 PM
satish kumar
satish kumar - avatar
0
I will share that
9th Dec 2021, 12:59 PM
satish kumar
satish kumar - avatar
0
a=[int(i) for i in input().split()] print(min(a)),print(a.index(min(a)))
9th Dec 2021, 1:17 PM
Amirreza
Amirreza - avatar
0
In Java, there are tools for that. You can use an ArrayList and Collections.min() to get the minimum value.
11th Dec 2021, 11:15 AM
Jan
Jan - avatar