I was creating a program to find largest and smallest number from array | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I was creating a program to find largest and smallest number from array

I was creating a program to find largest and smallest number from array but there is error in program ,help me solve the error link of code: https://code.sololearn.com/c5n3bR2YAE32/?ref=app

19th Mar 2022, 6:39 AM
Abhishek Shelar
Abhishek Shelar - avatar
2 Answers
+ 3
You have to change the line 17 on: L = S = n[0];
19th Mar 2022, 7:31 AM
JaScript
JaScript - avatar
+ 2
Abhishek Shelar You have to store first value in a temp variable If you want to store last value in a temp variable then you need to do (i - 1) because index start from 0 so last index would be (i - 1)
19th Mar 2022, 8:49 AM
A͢J
A͢J - avatar