I want all the responses to line up under each other
example:
x=y
y=x
ect...
not
x=y y=x ect...
// Julian Vizcarra
// Lab 05 question 2
public class Lab05_02 {
public static void main(String[] args) {
java.util.Scanner input = new java.util.Scanner(System.in);
// Enter an integer
System.out.print("Enter an integer: ");
int number = input.nextInt();
//compute math
int ok = number/5;
int ok2= number/6;
//If statement
if (number % 5 == 0 && number % 6 == 0){
System.out.print("Is " + number + " divisible by 5 and 6?" + " True " );}
else {System.out.print("Is " + number + " divisible by 5 and 6?" + " False " ); }
if (number % 5 == 0 || number % 6 == 0) {
System.out.print("Is " + number + " divisible by 5 or 6?" + " True " );}
else {System.out.print("Is " + number + " divisible by 5 or 6?" + " False " );}
if (number % 5 == 0 ^ number % 6 == 0) {
System.out.print("Is " + number + " divisible by 5 or 6, but not both" + " True");}
else {System.out.print("Is " + number + " divisible by 5 or 6, but not both" + " False");}
}
}
my output is:
Enter an integer: 60
Is 60 divisible by 5 and 6? True Is 60 divisible by 5 or 6? True Is 60 divisible by 5 or 6, but not both False