Page 5 - java programs
P. 5

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:
   1   2   3   4   5   6