forked from kishanrajput23/Java-Projects-Collections
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDice_Simulator.java
More file actions
25 lines (22 loc) · 728 Bytes
/
Copy pathDice_Simulator.java
File metadata and controls
25 lines (22 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.company;
import java.util.Random;
import java.util.Scanner;
public class Dice_Simulator {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
System.out.print("Enter the no of dice :");
int User_input= input.nextInt();
Random ran=new Random();
System.out.println("Hey User!you Rolled");
int Total=0;
int Computer_input=0;
for(int i=0;i<User_input;i++){
Computer_input= ran.nextInt(6)+1;
Total=Total+Computer_input;
System.out.print(Computer_input);
System.out.print(" ");
}
System.out.println(" total " + Total);
System.out.println(" ");
}
}