Shavit

Random Multiplication

Oct 7th, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. // Shavit Borisov
  2. // CW
  3.  
  4. import java.util.Scanner;
  5. import java.util.Random;
  6.  
  7. public class RandomMultiplication {
  8.  
  9.     public static void main(String[] args)
  10.    
  11.     {
  12.         Scanner in = new Scanner (System.in);
  13.         Random r = new Random ();
  14.        
  15.         System.out.println("Enter a number:");
  16.             int N = in.nextInt();
  17.            
  18.         int FirstRandom = 1 + r.nextInt(N);
  19.         int SecondRandom = 1 + r.nextInt(N);
  20.        
  21.         System.out.println("The multiplication is: " + FirstRandom + " X " + SecondRandom + " = " + FirstRandom * SecondRandom);
  22.        
  23.         in.close();
  24.     }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment