0
How do I display the largest number in an array without sorting out the whole array?
Arrays in C++
4 Answers
+ 3
take first element of array, initialize in variable max..compare it by all other values of array and if getting greater value of max, update max..keep doing this till last element.
or you can use max function in some languages.
+ 1
simple just compare..it...like
for(int i=0;i<a.length;i++)
if(a[i]>a[i+1])
max=a[i];
else
max=a[i+1];
0
thanks guys