Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Description
- // Given 2 positive int values, return the larger value that is in the
- // range 10..20 inclusive, or return 0 if neither is in that range.
- //
- // Example - max1020(a,b)
- // max1020(11, 19) → 19
- // max1020(19, 11) → 19
- // max1020(11, 9) → 11
- public class max1020 {
- public static void main(String []args) {
- int a, b;
- a = Integer.parseInt(args[0]);
- b = Integer.parseInt(args[1]);
- if ((a >= 10 && a <=20) || (b >= 10 && b <=20)) {
- if (a <= 20 && a > b) {
- System.out.println(a);
- } else {
- System.out.println(b);
- }
- } else {
- System.out.println("0");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement