Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- public class DiceRoll {
- public static void main(String[] args) {
- Random r = new Random();
- int result = r.nextInt(6);
- result = result + 1;
- System.out.println("You rolled a " +result);
- {
- //If the number is odd, you loose, if the number is even
- if ((result) % 2 == 0)
- System.out.println("You won!");
- else
- System.out.println("You loose :(");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement