Thursday, September 23, 2021

Pattern- 8 Star Print


Pattern- 8 Star Print




Logic- 

    

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

 



Program--



                                                               * * * * *
                                                          * * * *
                                                     * * *
                                                                         * *
                                                                            *
               
 
           

      class Pattern8 
{
  public static void main(String[] args)
   {
  for(int i=1; i<=5; i++)
      {
   for(int j=2; j<=i; j++)
      {
   System.out.print("  ");
      }
   {
for(int k=i; k<=5; k++)
          System.out.print("* ");
       }
             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++)                          {              ...