Saturday, September 18, 2021

Pattern -5 Number print 1 to 25

                         


Pattern -5

      

Logic--- 

                                     int k=1;


                                       for(int i=1; i<=5; i++) 

                                   {
                                for(int j=1; j<=5; ++j)
                                {
       
                                  System.out.print(k++  +  " ");
                                         }
                                            System.out.println( );    
                          }


Program---

    
                                                            1  2  3  4  5
                                                           6  7  8  9  10
                                                          11 12 13 14 15
                                                             16 17 18 19 20
                                                         21 22 23 24 25


 
         class Pattern5
{
            public static void main(String[] args)
{
          int k=1;

                for(int i=1; i<=5; i++) 
                  {
               for(int j=1; j<=5; ++j)
               {
       
                System.out.print(k++ +  " ");

                         }
                           System.out.println( );    
          }
}
}

For Proper Understanding Watch the Video :-






Thanks;) 
All the Best :)
Keep Learning:) 


         Study:)

  Youtube                      Instagram                             Facebook  
  


 Self:)                                             Instagram                           Facebook



No comments:

Post a Comment

Pattern- 9 Star Pattern

  Pattern- 9 Star Pattern  Logic-                                  for(int i=1; i<=5; i++)                          {              ...