In this tutorial, we are going to write a Java program to generate random numbers between 1 to 100 in Java Programming with practical program code and step-by-step full complete explanation.

Java program to generate random numbers between 1 to 100


Java program to generate random numbers between 1 to 100.

 
class Main
{
    public static void main(String args[])
    {
        for(int i=1;i<=5;i++)
        {
            System.out.println((int)(Math.random()*100));
        }
    }
}


Output

54
52
24
79
58