Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.util.Random;
- public class Lottery {
- public static void main(String[] args) {
- Scanner keyboard = new Scanner(System.in);
- System.out.print("Enter a number between 1 and 10: ");
- int userNum = keyboard.nextInt();
- Random rndNum = new Random();
- int winningNum = rndNum.nextInt(10)+1;
- System.out.println("Your number: " + userNum);
- System.out.println("The winning number is: " + winningNum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement