Skip to content

Instantly share code, notes, and snippets.

@ellbur
Created October 12, 2011 04:28
Show Gist options
  • Save ellbur/1280275 to your computer and use it in GitHub Desktop.
Save ellbur/1280275 to your computer and use it in GitHub Desktop.
Smallest Largest
public class SmLr {
public static void main(String[] args) {
int stop = IO.readInt();
int input = IO.readInt();
int highest = input;
int lowest = input;
while (input != stop) {
if (input > highest) {
highest = input;
}
if (input < lowest) {
lowest = input;
}
input = IO.readInt();
}
System.out.println(lowest);
System.out.println(highest);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment