Pattern programs in Java

Pattern 1 Output

  0
  0   1
  0   2    4
  0   3    6    9
  0   4    8   12   16
  0   5   10   15   20   25
  0   6   12   18   24   30   36
  0   7   14   21   28   35   42   49
  0   8   16   24   32   40   48   56   64
  0   9   18   27   36   45   54   63   72   81

Source Code

Below source code will print the same desired output result

class Pattern1
{
	public static void main(String[] args)
	{
		int n = 10;

		for(int i = 0; i < n; i++)
		{
			for(int j = 0; j <= i; j++)
			{
				System.out.print("\t" + (i * j));
			}
			System.out.println();
		}
	}
}

Hope you find this helpful!

Keep helping and happy 😄 coding

Avatar

A web geek, an industry experienced web developer & tutor/instructor residing in India 🇮🇳

Next
Previous

Related