Pattern Example in Java


Patterns Designing in Java Programming Most Easy Way To Design Pattern .















Example:



package patterns;

public class patternexp1 {


public static void main(String[] args) {

for(int i=1;i<=5;i++)   // No of rows
{
for(int j=1;j<=i;j++)  //print the value
{

System.out.print(j);

}

System.out.println("");
}
}

}

Output:

1
12
123
1234
12345

Explanation:



No comments:

Post a Comment