Advertisement
BojidarDosev

Write a program to read an integer n and print all triples of the first n small Latin letters, order

Jan 28th, 2025
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class game_Store {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int start = Integer.parseInt(scanner.nextLine());
  8.  
  9.         char[] alphabet = "abcdefghijklmnopqrstuvwxyz".toCharArray();
  10.         int temp = start;
  11.  
  12.             for (int i = 0; i < temp; i++) {
  13.  
  14.                 for (int j = 0; j < temp; j++) {
  15.  
  16.                     for (int k = 0; k < temp; k++) {
  17.                         System.out.print(alphabet[i]);
  18.                         System.out.print(alphabet[j]);
  19.                         System.out.print(alphabet[k]);
  20.                         System.out.println();
  21.  
  22.                     }
  23.  
  24.                 }
  25.  
  26.             }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement