1a2b
3c4d
5e6f
7g8h
package javaapplication1;
import java.util.*;
class pat9 {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int i, j, k = 1;
char c = 97;
for (i = 1; i <= 4; i++) {
for (j = 1; j <= 4; j++) {
if (j % 2 == 0) {
System.out.print(c);
c++;
} else {
System.out.print(k);
k++;
}
}
System.out.println();
}
}
}
No comments:
Post a Comment