Java Arithmetic Operators Modulus Operator start new line every 10 elements

Description

Java Arithmetic Operators Modulus Operator start new line every 10 elements

import java.util.Random;

public class Main {

  public static void main(String... args) {

    Random rand = new Random();
    int[] a = new int[100];
    for (int i = 0; i < 100; i++) {
      a[i] = rand.nextInt(100);//from  w ww.j a  v  a  2  s  . c o m
      System.out.print(a[i] + ", ");
      if ((i + 1) % 10 == 0) {
        System.out.println();
      }
    }
  }
}



PreviousNext

Related