Increment i if new highest value occurs Increment j if new lowest value occurs
foreach ( int n in arr ) { if ( h_score < n ) { h_score = n ; i ++ ; } if ( l_score > n ) { l_score = n ; j ++ ; } } Console . Write ( " Number ▁ of ▁ times ▁ maximum ▁ value ▁ " ) ; Console . Write ( " updated ▁ = ▁ " + i + " STRNEWLINE " ) ; Console . Write ( " Number ▁ of ▁ times ▁ minimum ▁ value ▁ " ) ; Console . Write ( " updated ▁ = ▁ " + j ) ; }