+ 1

[solved] Java program by searching the array[] for the number requested by the user. If number is found in table program will te

/* Java program by searching the table for the number requested by the user. If a number is found in a table, the program will tell the index of the number. If the number is not found in the table again, the program tells you that no number is found. */ /** Thanks for user: Avinesh for code finishing! * * @author 0ks4 */ Updated working source code https://code.sololearn.com/cnw7MhanqdIt

10th Nov 2019, 5:36 PM
0ks4
0ks4 - avatar
4 Respostas
+ 1
Thanks for both of you! @Jaya krishna and @Avinesh :) The index search code was not yet publish on the Sololearn platform. I try make while loop because I think it`s easier edit right variables. Like as a general rule if the code doesn't work. The solution is to make a small change in a variable. @Avinesh for modification makes code working to perfection! If that's right for you i update my orginal code and in comment I'll mention you as a code in finisher? This question header can change [solved]
11th Nov 2019, 6:10 AM
0ks4
0ks4 - avatar
0
Your code works fine. But to get required output make changes as: Last print statement move into if statement of while loop.. Print only index not table[index]... Check ones.. then reply.. can be optimized with for loop..
10th Nov 2019, 6:07 PM
Jayakrishna 🇮🇳
0
0ks4 Your output just became more readable, let me know if you like it. https://code.sololearn.com/cNMYaTaa93NS/?ref=app
10th Nov 2019, 6:17 PM
Avinesh
Avinesh - avatar
0
0ks4 Yea I will be fine with it.
11th Nov 2019, 7:02 AM
Avinesh
Avinesh - avatar