Javatpoint Logo

program to find largest and smallest number with out using arrays

By: arohit*** On: Wed Feb 19 17:49:55 PST 2014     Question Reputation1 Answer Reputation9 Quiz Belt Series Points0  10Blank User
1.java program to find largest and smallest number with out using arrays
2.java program to find 1st largest and 2nd largest number with out using arrays
logic should be simple
Up0Down

 
use collection max and min.

int max= Integer.MIN_VALUE;
int min= Integer.MAX_VALUE;
for(int x=0;x<inpNum;x++){
max = Math.max(max,x);
min = Math.min(min,x);
Image Created0Down

By: [email protected] On: Thu Feb 20 02:36:49 PST 2014 Question Reputation0 Answer Reputation392 Belt Series Points0 392User Image
Are You Satisfied :2Yes1No