title: how does a modulus work when you want to print set of numbers per line
body: <p>Can someone please explain to me how does the modulus work if you wanna print set of numbers per line like in the given code below? I only know that the role of the modulus is to give the remainder of a number and that's about it. I would like to know the process it goes through.     </p>
  
  <pre><code>int []arrayLoterry= new int[50];
  String output="";
  
     for(int i=0;i&lt;arrayLoterry.length;i++){
        arrayLoterry[i]=(int) Math.floor(Math.random()*49)+i;
        output+=arrayLoterry[i]+" ";
  
        if(i%10==9){
           output+="\n";
        }
     }
  
  System.out.println(output);
  </code></pre>