Advertisement
joseleonweb

Untitled

Jan 29th, 2021
819
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.util.Random;
  3.  
  4. public class Lottery {
  5.  
  6.     public static void main(String[] args) {
  7.         Scanner keyboard = new Scanner(System.in);
  8.         System.out.print("Enter a number between 1 and 10: ");
  9.         int userNum = keyboard.nextInt();
  10.         Random rndNum = new Random();
  11.         int winningNum = rndNum.nextInt(10)+1;
  12.         System.out.println("Your number: " + userNum);
  13.         System.out.println("The winning number is: " + winningNum);
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement