public class Order {
public static void main(String[] args) {
System.out.println(consecutive(5, 6, 8));
System.out.println(consecutive(9, 7, 8));
System.out.println(consecutive(7, 8, 9));
}
public static boolean consecutive(int x, int y, int z) {
if (x + 1 == y && y + 1 == z ){
return true;
}
else {
return false;
}
}
}
i have it so that if the numbers are in order it reads true but i cant get it to read if they are not arranged in the correct order but the numbers are there to get it to read true there for if you enter any numbers in the right order it will read true but if all the numbers are there and you don't enter them in order it will read false have trouble trying to figure out what im missing to have it work both ways the first one should read false and the next 2 should be true any help is appreciated

New Topic/Question
Reply



MultiQuote









|