You are viewing a single comment's thread. Return to all comments →
All is good. but, possibly its good practice to eliminate imagining min or max.
for this
// set the first value of array as min or max then start //comparing from next element
b[0] = in.nextInt(); minB = b[0];
// then
for(int b_i = 1; b_i < m ; b_i++ ) { int tmp = in.nextInt(); minB = tmp < minB ? tmp:minB; b[b_i] = tmp; }
:)
Seems like cookies are disabled on this browser, please enable them to open this website
Between Two Sets
You are viewing a single comment's thread. Return to all comments →
All is good. but, possibly its good practice to eliminate imagining min or max.
for this
// set the first value of array as min or max then start //comparing from next element
b[0] = in.nextInt(); minB = b[0];
// then
for(int b_i = 1; b_i < m ; b_i++ ) { int tmp = in.nextInt(); minB = tmp < minB ? tmp:minB; b[b_i] = tmp; }
:)