Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class hw6.2a {
- public static void main(String[] args) {
- Scanner s = new Scanner(System.in);
- int first = s.nextInt();
- int max = first;
- int min = first;
- while(s.hasNextInt()) {
- int next = s.nextInt();
- if ( next > max) {
- max = next;
- }
- if ( min > next ) {
- min = next;
- }
- }
- System.out.println("Maximum = " + max);
- System.out.println("Minimum = " + min);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement