Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static final char alphabet[] = {'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 char defLettre(int j) {
- char result = alphabet[j];
- return result;
- }
- public static void runThis(int n) {
- for (int l = 1; l <= 2 * n - 1; l++) {
- System.out.println("\n");
- for (int c = 1; c <= 2 * n - 1; c++) {
- boolean match = false;
- for (int j = 1; j < 2 * n; j++) {
- if ((l == 1) || (l == 2 * n - j) || (c == 1) || (c == 2 * n - j)) {
- if (j == 1) {
- System.out.print('a');
- } else {
- System.out.print(defLettre(j - 1));
- }
- match = true;
- break;
- }
- }
- }
- }
- }
- }
- J'obtiens ça :
- aaaaaaa
- afedcba
- aeedcba
- adddcba
- accccba
- abbbbba
- aaaaaaa
- Je veux obtenir ça :
- aaaaaaa
- abbbbba
- abcccba
- abcdcba
- abcccba
- abbbbba
- aaaaaaa
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement