Page 258 - CA_Blue( J )_Class9
P. 258

Program 13     Write a program to display the following pattern:
                                         1 2 3 4 5
                                         2 3 4 5
                                         3 4 5
                                         4 5
                                         5

                     1     class numberpyramid_reverse
                     2     {

                     3         public static void main(String args[])
                     4         {
                     5             for (int i = 1; i <= 5; i++)

                     6             {

                     7                 for (int j = i; j <= 5; j++)
                     8                 {
                     9                     System.out.print(j + " ");

                   10                  }
                   11              System.out.println();

                   12          }}}


                  You will get the following output:











































                   256    Touchpad Computer Applications-IX
   253   254   255   256   257   258   259   260   261   262   263