자바_기초
반복문 문제) while + char
잠수콩
2019. 5. 14. 08:45
package Loop;
public class exam_loop_AZ {
public static void main(String[] args) {
System.out.println("==========과제1=========");
char ch_2 = 'A';
char ch_3 = 'A';
int k = 1;
//65 66 67 68 69 70
//71 72 73 74 75 76
//77 78 79 80 81 82
//83 84 85 86 87 88
//89 90
while(ch_2 <= 'Z') {
if ( (int)ch_2 == (int)ch_3 - 1 + (k * 6) ) {
System.out.println(ch_2);
k++;
} else {
System.out.print(ch_2);
}
ch_2++;
}
System.out.println("-----------------------------");
}
}