Wednesday, November 21, 2012

Random Number in java

import java.util.Random;
class rand
{
public static void main(String args[])
{
int i;
System.out.println("Random Number (0-100):");
Random rn=new Random();
for(i=0;i<10;i++)
{
int rint=rn.nextInt(100);
System.out.println(" "+rint);
}
}
}



/*OUTPUT:


Random Number (0-100):

7
20
75
10
46
10
87
90
58
97
*/

0 comments:

Post a Comment