Skip to content

Commit 7cab00c

Browse files
authored
Create evenlySpaced.java
1 parent 42ad808 commit 7cab00c

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Logic-2/evenlySpaced.java

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
public boolean evenlySpaced(int a, int b, int c) {
2+
if(a > c)
3+
{
4+
int aux = a;
5+
a = c;
6+
c = aux;
7+
}
8+
9+
if(a > b)
10+
{
11+
int aux = a;
12+
a = b;
13+
b = aux;
14+
}
15+
16+
if(b > c)
17+
{
18+
int aux = b;
19+
b = c;
20+
c = aux;
21+
}
22+
23+
return a-b == b-c;
24+
}
25+
26+
// we sort the 3 nums fisrt

0 commit comments

Comments
 (0)