Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package CSCE145;
- //written by --
- import java.util.Random;
- import java.util.Scanner;
- public class Main {
- Random random = new Random();
- public static void main(String[] args) {
- Scanner keyboard = new Scanner(System.in);
- System.out.print("Enter the number of times a 6 sided die should be rolled.");
- int die = keyboard.nextInt();
- int a = 0;
- if(die>a){
- for(int i = 0; i<die; i++){
- int num = (int)(6 * Math.random()+1);
- System.out.println(num);
- }
- }
- else
- System.out.println("Please enter a positive value");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement