Java Code To Print Check Number Pattern Program

March 22, 2023

Program:

public class Pattern2
{
	public static void main(String args[])
	{
		int a=1;
		for(int i=1;i<=9;i=i+2)
		{
			for(int j=1;j<=i;j++)
			{
				System.out.print(a);

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

Compile:

javac Pattern2.java
 java Pattern2

Output:

1
222
33333
4444444
555555555

You Might Also Like