Given the following four patterns,
Which of the pattern is produced by the following code?
```
for (int i = 1; i <= 6; i++) {
for (int j = 6; j >= 1; j--)
System.out.print(j <= i ? j + " " : " " + " ");
System.out.println();
}
```
a. Pattern A
b. Pattern B
c. Pattern C
d. Pattern D
c. Pattern C
The outer loop displays a line. The inner loop displays all the numbers in the line. The outer loop is repeated 6 times for i from 1 to 6. For each i, the inner loops displays i as the first number in the line since j is from 6 to 1. j is printed for j <= i. Otherwise, a space is printed. Clearly, this code will print Pattern C.
Computer Science & Information Technology