SHARE
TWEET

RandomNum

Vankata17 Dec 11th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Random;
  2. import java.util.Scanner;
  3.  
  4. public class PROGRAMM {
  5.  
  6.     public static void main(String[] args) {
  7.         Scanner scan = new Scanner(System.in);
  8.         Random rand = new Random();
  9.         int num1 = rand.nextInt(11);
  10.         System.out.print("ENTER NUM 1:  ");
  11.         int a = scan.nextInt();
  12.         System.out.print("ENTER NUM 2:  ");
  13.         int b = Integer.parseInt(scan.nextLine());
  14.         if ((a == num1) &&(b == num1)) {
  15.             System.out.println("You win  " + num1);
  16.         } else {
  17.             System.out.println("You lose  " + num1);
  18.         }
  19.  
  20.     }
  21.  
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top