Java 如何让我的System.out.prints在彼此下面对齐?
我希望所有的回答都排成一行 例如: x=y y=x 等等 不是 x=y y=x ectJava 如何让我的System.out.prints在彼此下面对齐?,java,Java,我希望所有的回答都排成一行 例如: x=y y=x 等等 不是 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("Ent
// 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");}
}
}
我的输出是:
输入一个整数:60
60可以被5和6整除吗?真的是60可以被5或6整除吗?True是60,可以被5或6整除,但不能同时为False和False使用,而不是System.out.print()