Friday, January 23, 2015

RandomInt.java in pgm



RandomInt.java

public class RandomInt 
{ 
public static void main(String[] args) 
{ 
        int N = Integer.parseInt(args[0]);
        double r = Math.random();
        int n = (int) (r * N);
                     System.out.println("Your random integer is: " + n);
    }
}

No comments:

Post a Comment