Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- boolean evenlySpaced(int a, int b, int c) {
- if (mid(a, b, c) - min(a, b, c) == max(a, b, c) - mid(a, b, c)) {
- return true;
- } else {
- return false;
- }
- }
- int max(int a, int b, int c) {
- int ret;
- if (a > b && a > c) {
- ret = a;
- } else if (b > c) {
- ret = b;
- } else {
- ret = c;
- }
- return ret;
- }
- int mid(int a, int b, int c) {
- int ret;
- if ((a > b && a < c) || (a > c && a < b)) {
- ret = a;
- } else if ((b > a && b < c) || (b > c && b < a)) {
- ret = b;
- } else {
- ret = c;
- }
- return ret;
- }
- int min(int a, int b, int c) {
- int ret;
- if (a < b && a < c) {
- ret = a;
- } else if (b < c) {
- ret = b;
- } else {
- ret = c;
- }
- return ret;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement