WRITE A PROGRAM TO PRINT A BINARY RIGHT ANGLED TRIANGLE UPTO N TERMS IN JAVA


elegance Btri

{

public static void primary(String args[])

        {

            int i, j,n;

          n=Integer.parseInt(args[0]);               

          for (i = 1; i <= n; i++)

            {

                for (j = 1; j <= i; j++)

                {

                    if (j % 2 == 0)

                    {

                        Machine.out.print(“0 “);

                    }

                    else

                    {

                        Machine.out.print(“1 “);

                    }

                }

                    Machine.out.println(“”);

            }

         }

      }

btrijava.JPG



Supply hyperlink

Leave a Reply

Your email address will not be published.

Back To Top