public class JavaProgram
{
public static void main(String args[])
{
int n=1, i, j;
for(i=0; i<10; i++)
{
for(j=0; j<i; j++)
{
System.out.print(n + " ");
n++;
}
System.out.println();
}
}
}
When the above Java program is compile and executed, it will produce the following
output: