public static void main(String[] args) {
System.out.println("\n");
StringBuffer triangle = new StringBuffer();
for (int i = 0; i <= 5; i++) {
for (int j = i; j <= 5; j++) {
triangle.append(" ");
}
for (int k = 0; k <= i; k++) {
triangle.append("* ");
}
triangle.append("\n");
}
System.out.println(triangle);
}
}
Awesome. I am a beginner and this article helped me to resolve the problem .Thank
ReplyDeleteyou author and the whole expect team.
http://www.wikitechy.com/view-article/java-program-to-print-a-stars-and-numbers-in-triangular-pattern
Both are really good,
Cheers,
Venkat