OOP-JAVA Practical 12
- Aim: Write a program that creates a Random object with seed 1000 and displays the first 100 random integers between 1 and 49 using the NextInt (49) method.
- Code:
import java.util.Random; public class practical12 { public static void main(String[] args) { Random random=new Random(1000); for(int i=0;i<100;i++){ System.out.format("%3d",random.nextInt(49)); if ((i+1)%25==0) { System.out.println(); } } } }
- Output:
Comments
Post a Comment