Created
October 12, 2011 04:28
-
-
Save ellbur/1280275 to your computer and use it in GitHub Desktop.
Smallest Largest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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