Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class PrintDeckOfCards {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String[] suit = {"spades", "clubs", "hearts", "diamonds"};
- String[] cards = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"};
- int n = scanner.nextInt();
- int counter = 0;
- for (int i = 0; i <= 14; i++) {
- for (int j = 0; j < 4; j++) {
- if (i > n - 2)
- continue;
- if (j < 3)
- System.out.printf("%s of %s, ", cards[i], suit[j]);
- counter++;
- if (counter % 4 == 0) {
- System.out.printf("%s of %s", cards[i], suit[j]);
- System.out.println();
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement