how to display this pattern in java?
Attachments:
Answers
Answered by
0
Java Programming
Explanation:
public class Pattern
{
public static void main(String[] args)
{
int num = 1;
for (int i = 1; i < 7; i++) {
for (int j = i; j > 0 ; j--) {
if (i%2==0)
System.out.print(num + "\t");
else
System.out.print("*" + "\t");
} if (i%2==0)
num++;
System.out.println();
}
}
}
Similar questions
Physics,
1 month ago
Math,
2 months ago
Math,
9 months ago
English,
9 months ago
CBSE BOARD X,
9 months ago