Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- import java.util.Scanner;
- public class DiceRoll {
- public static void main(String[] args) {
- int b = 1;
- while (b == 1){
- Scanner keyboard = new Scanner(System.in);
- System.out.println("Pick a number from 0 - 10 :: ");
- int result = keyboard.nextInt();
- double computer = Math.random()* 10;
- int run = (int) computer;
- System.out.println("You rolled a " + result);
- System.out.println("The Computer called a " + run);
- {
- if (result == run)
- System.out.println("You won!");
- else{
- System.out.println("You lost, and must play until you win.");
- b = 1; }
- }
- // 1.) 2 3 4
- // 2.) 2 5
- // 3.) 3 4 5 6 7 8
- // 4.) 3
- // 5.) 5 7 9
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement