-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIn1020.java
More file actions
22 lines (20 loc) · 523 Bytes
/
In1020.java
File metadata and controls
22 lines (20 loc) · 523 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
* Given 2 int values, return true if either of them is in the range 10..20 inclusive.
* in1020(12, 99) → true
* in1020(21, 12) → true
* in1020(8, 99) → false
*/
public class In1020 {
//Class for testing and setting dummy values
public static void main( String [] args ) {
//Output tests
System.out.println( in1020( 5, 8 ) );
}
public static boolean in1020( int a, int b ) {
if( ( a >= 10 && a <= 20 )|| ( b >= 10 && b <= 20 ) ) {
return true;
} else {
return false;
}
}
}