Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Deck {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int cardIndex = scanner.nextInt() - 1;
- int card = 2 + cardIndex / 4;
- int suit = cardIndex % 4;
- for (int i = cardIndex; i < 52; i++) {
- if (card <= 10) {
- System.out.print(card);
- } else if (card == 11) {
- System.out.print('J');
- } else if (card == 12) {
- System.out.print('D');
- } else if (card == 13) {
- System.out.print('K');
- } else if (card == 14) {
- System.out.print('A');
- }
- if (suit == 0) {
- System.out.print((char) 0x2663);
- } else if (suit == 1) {
- System.out.print((char) 0x2666);
- } else if (suit == 2) {
- System.out.print((char) 0x2665);
- } else if (suit == 3) {
- System.out.print((char) 0x2664);
- }
- if (i < 51) {
- System.out.print(',');
- System.out.print(' ');
- } else {
- System.out.println();
- }
- if (i % 4 == 3) {
- card++;
- }
- suit++;
- if (suit > 3) {
- suit = 0;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement