How do I print this pattern modifying my original code below:
I am a beginner in java and not able to create the pattern listed below.
Pattern:
1
1 ,1
1 ,2 ,1
1 ,3 ,3 ,1
1 , 4 , 6 , 4 , 1
1 , 5 , 1 0 , 1 0 , 5 , 1
My Code:
public class Q2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int count = 5;
for (int i = 1; i <= count; i++) {
for (int j = 1; j <= i; j++) {
System.out.print(i);
}
System.out.println();
}
}
}
My Output:
1
22
333
4444
55555