Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- import java.util.Scanner;
- class MaxminFinder {
- public static void main(String[] args) {
- long ArrayNumber[] = new long[args.length];
- long max=0,min=0;
- for (int i = 0; i < args.length; i++) {
- try{
- ArrayNumber[i] = Long.parseLong(args[i]);
- }catch(Exception e){}
- if(min>ArrayNumber[i])
- min=ArrayNumber[i];
- else if(max<ArrayNumber[i])
- max=ArrayNumber[i];
- }
- System.out.print(max);
- if(max%2==0)
- System.out.print(" Even number");
- else
- System.out.print(" odd number");
- System.out.print("\n"+min);
- if(min%2==0)
- System.out.print(" Even number");
- else
- System.out.print(" odd number");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment