Page 255 - CA_Blue( J )_Class9
P. 255

You will get the following output:





















                  Program 10     Write a program to display the following pattern:
                                        a
                                        b c
                                        d e f
                                        g h i j
                   1      class for_charpattern2
                   2          {

                   3              public static void main()
                   4              {

                   5                  int i,j,k=1;
                   6                  for(i=1;i<=4;i++)

                   7                  {   for(j=1;j<=i;j++)
                   8                      {      System.out.print((char)(96+k)+ " ");

                   9                              k++;
                  10                      }

                  11                      System.out.println();
                  12                  }
                  13              }

                  14          }


                 You will get the following output:


















                                                                                                   Nested Loop   253
   250   251   252   253   254   255   256   257   258   259   260