Computer Science, asked by riyaa8773, 2 months ago

how to display this pattern in java? ​

Attachments:

Answers

Answered by devarchanc
0

Java Programming

Explanation:

public class Pattern

{

      public static void main(String[] args)

   {

       int num = 1;  

       

           for (int i = 1; i < 7; i++) {

           for (int j = i; j > 0 ; j--) {

            if (i%2==0)

               System.out.print(num + "\t");

           else

               System.out.print("*" + "\t");

             

           }  if (i%2==0)

                num++;

           

           System.out.println();

           }

   }

}

Similar questions