0% found this document useful (0 votes)
29 views1 page

01

The document contains a Java program that generates and prints a specified number of random integers between 0 and 8. It prompts the user to enter the desired size of the output. The program utilizes the Scanner and Random classes for input and random number generation, respectively.

Uploaded by

BHAVESH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views1 page

01

The document contains a Java program that generates and prints a specified number of random integers between 0 and 8. It prompts the user to enter the desired size of the output. The program utilizes the Scanner and Random classes for input and random number generation, respectively.

Uploaded by

BHAVESH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

AmanJamwal — Today at 09:07

// Online Java Compiler


// Use this editor to write, compile and run your Java code online
import java.util.Scanner;
import java.util.Random;
class RandomNum {
public static void main(String[] args) {
int rand_num;
Scanner Sc=new Scanner(System.in);
Random rand=new Random();
System.out.println("Enter the size :");
int a=Sc.nextInt();
for(int i=0;i<a;i++){
rand_num=rand.nextInt(9);
System.out.print(rand_num);
}

}
}

You might also like