Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

public class Main {
    public static void main(String[] args) {
        int[] list = new int[100];

        for (int i = 0; i < list.length; i++) {
            list[i] = (int) (Math.random() * 50 + 1);
        }

        int elementInOneLine = 0;

        for (int i = 0; i < list.length; i++) {
            if (elementInOneLine == 10) {
                System.out.println();
                elementInOneLine = 0;
            }
            System.out.print(list[i] + " ");
            elementInOneLine++;
        }
    }
}