Exercise Cycles

package eserciziocicli;
import javax.swing.*;
public class EsercizioCicli {
public static void main(String[] args) {
/*
* Insert the number of iterations as input
* and print the sequence as follows
* 1
* 12
* 123
* 1234
* 12345
*
*/
// insert input with JOPtionPane
String tmp;
int numeroIterate=0;
tmp=JOptionPane.showInputDialog("Inserisci il numero di iterate");
numeroIterate=Integer.parseInt(tmp);
String acc="";
int i=1;
while (i<numeroIterate)
{
System.out.println(acc);
if (i%3 == 0)
{
acc=acc+" " + i;
}
i++;
}

}