Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- public class DiceDoubles
- {
- public static void main(String[] Args)
- {
- Random r = new Random();
- int dice1 = -1, dice2 = -2, tries = 0;
- System.out.println("Here Comes The Dice!");
- while (dice1 != dice2)
- {
- dice1 = 1 + r.nextInt(6); dice2 = 1 + r.nextInt(6);
- tries ++;
- System.out.println("Roll #1: " + dice1 + "\nRoll #2: " + dice2 + "\nThe total is " + (dice1 + dice2) + "!\n");
- }
- System.out.println("\nYou got a double after " + tries + " tries!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement