Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine()) + 97;
- for (int a = 97; a < n; a++) {
- for (int b = 97; b < n; b++) {
- for (int c = 97; c < n; c++) {
- System.out.printf("%c%c%c\n", a, b, c);
- }
- }
- }
- }
- }
- OR:
- import java.util.Scanner;
- class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine()) + 97;
- for (int a = 'a'; a < n; a++) {
- for (int b = 'a'; b < n; b++) {
- for (int c = 'a'; c < n; c++) {
- System.out.printf("%c%c%c\n", a, b, c);
- }
- }
- }
- }
- }
- OR:
- import java.util.Scanner;
- class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- char n = (char)(Integer.parseInt(scanner.nextLine()) + 97);
- for (char a = 'a'; a < n; a++) {
- for (char b = 'a'; b < n; b++) {
- for (char c = 'a'; c < n; c++) {
- System.out.printf("%c%c%c\n", a, b, c);
- //System.out.printf("%s%s%s\n", a, b, c);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement