Results 1 to 2 of 2
  1. #1
    mamoonrizwan is offline Member
    Join Date
    Apr 2011
    Posts
    19
    Rep Power
    0

    Default checking min of four random numbers

    import java.util.Random;
    public class MinimumOfFourRandomNumbers {
    public static void main(String args[]){

    Random random = new Random();

    int num1 = random.nextInt(10);
    int num2 = random.nextInt(10);
    int num3 = random.nextInt(10);
    int num4 = random.nextInt(10);

    System.out.println(num1);
    System.out.println(num2);
    System.out.println(num3);
    System.out.println(num4);

    int x = Math.min(num1,num2);
    int y = Math.min(num3,num4);




    System.out.println("the minimum of num1 ,num2,num3 and num4 is" + Math.min(x,y) );
    }

    }

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. checking minmum of two random numbers
    By mamoonrizwan in forum New To Java
    Replies: 2
    Last Post: 05-07-2011, 08:56 AM
  2. Replies: 8
    Last Post: 04-19-2009, 05:50 PM
  3. random numbers without random class`
    By carlos123 in forum New To Java
    Replies: 4
    Last Post: 01-17-2008, 10:44 PM
  4. checking if there are equal numbers
    By nalinda in forum New To Java
    Replies: 1
    Last Post: 11-18-2007, 06:21 AM
  5. checking if there are equal numbers
    By nalinda in forum New To Java
    Replies: 0
    Last Post: 11-18-2007, 02:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •