我如何在 pattern/output 中打印此字母表:a B c D e F g H i J k L m N o P q R s T u V w X y Z
How do i print this Alphabets in this pattern/output : a B c D e F g H i J k L m N o P q R s T u V w X y Z
使用anyloop我将如何在a中打印代码
像这样的小和大模式:a B c D e F g H i J k L m N o P q R s T u V w X y Z
System.out.println("Aphabets In Small And Big Letter Pattern");
// Responsible for Small Letters
for(SLet = 'a'; SLet < 'z'; SLet++){
while(SLet%2!=0)
{
System.out.print(SLet+ " ");
SLet++;}
}
System.out.println();
// Responsible for Big Letters
for(BLet = 'A'; BLet <= 'Z'; BLet++){
while(BLet%2!=1)
{
System.out.print(BLet+ " ");
BLet++;}`}
}`
// Combination of Small and Big Letter
// 结果是这样的:a B c D e F g H i J k L m N o P q R s T u V w X y Z
这段代码对我有用:(如果偶数,写成小写)
public static void main(String[] args) {
for (char SLet = 'A'; SLet < 'Z' + 1; SLet++) {
char toPrint = SLet;
if (SLet % 2 != 0)
toPrint = Character.toLowerCase(toPrint);
System.out.print(toPrint + " ");
}
System.out.println();
}
使用anyloop我将如何在a中打印代码 像这样的小和大模式:a B c D e F g H i J k L m N o P q R s T u V w X y Z
System.out.println("Aphabets In Small And Big Letter Pattern");
// Responsible for Small Letters
for(SLet = 'a'; SLet < 'z'; SLet++){
while(SLet%2!=0)
{
System.out.print(SLet+ " ");
SLet++;}
}
System.out.println();
// Responsible for Big Letters
for(BLet = 'A'; BLet <= 'Z'; BLet++){
while(BLet%2!=1)
{
System.out.print(BLet+ " ");
BLet++;}`}
}`
// Combination of Small and Big Letter
// 结果是这样的:a B c D e F g H i J k L m N o P q R s T u V w X y Z
这段代码对我有用:(如果偶数,写成小写)
public static void main(String[] args) {
for (char SLet = 'A'; SLet < 'Z' + 1; SLet++) {
char toPrint = SLet;
if (SLet % 2 != 0)
toPrint = Character.toLowerCase(toPrint);
System.out.print(toPrint + " ");
}
System.out.println();
}