I have an array of ints. I want to get the second highest number in that array. Is there an easy way to do this?
max1=0; max2=0; for( int i=0; i < a.Length; i++) { if (arr[i]> max1) { max2=max1; max1=arr[i]; } else { if (a[i]!= max1) && ( a[i] > max2) max2[i]=arr[i]; } }