Max Number | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Max Number

I need to find Max no. Index without sorting . And if there are two same Numbers then i need to give smaller one's index I know from sorting

13th Nov 2016, 7:47 AM
Ali Tahir
Ali Tahir - avatar
1 Answer
0
int max = arr[0]; for(i=1; i<n; ++i) if(arr[i] > max) max = arr[i];
13th Nov 2016, 9:12 AM
Marcell Juhasz