Home > Back-end >  java
java

Time:09-19

Could you tell me how to achieve bosses this?

CodePudding user response:

Put to the value of the output array
The third question, for example, A to Z put A 2 d array list1, a-z list2, put A two-dimensional array list1 output line list2 output line again, finally in A loop line
The fourth problem is the rows as columns broomrape lines output is good, and so on

CodePudding user response:

Is this job? Is the most basic print control,
If use arrays, no difficulty,
Without an array, is the time when the vertical print control the gap between the two letters in a row is good (a total of four lines, so the gap between the two letters in a row is 4),
Give you code reference

 public class Sample {
Public static void main (String [] args) {
//Q1
for (int i=0; i<26. I +=5) {//5 a cycle
for (int j=0; J<5; J++) {//print the capital letters
System. The out. Printf (" % c ", (I + j) & lt; 26? (' A '+ I + j) : ");
}
System. The out. Printf (" \ t ");//the gap between the capitalization
for (int j=0; J<5; J++) {//print lowercase
System. The out. Printf (" % c ", (I + j) & lt; 26? (' a '+ I + j) : ");
}
System.out.println();//to wrap the
}


System.out.println();
//Q2
for(int i=0; i<4. I++) {
for (int j=0; J<26. J +=4) {//every four letters in a row to print
System. The out. Printf (" % c ", (I + j) & lt; 26? 'A' + (I + j) : ");
}
System.out.println();//line breaks
}

System.out.println();
//Q3
//combination of Q1 and Q2 can
for (int i=0; i<4. I++) {
for (int j=0; J<26. J +=4) {//every four letters in each row printing, print caps
System. The out. Printf (" % c ", (I + j) & lt; 26? 'A' + (I + j) : ");
}
System. The out. Printf (" \ t ");//the gap between the capitalization
for (int j=0; J<26. J +=4) {//printing lower-case
System. The out. Printf (" % c ", (I + j) & lt; 26? 'a' + (I + j) : ");
}
System.out.println();//to wrap the
}
}
}