Java is one of the very powerful programming languages. This post will learn how to program star printing shapes in Java.
Why do we need to learn different star printing patterns?
Well, programming is all about applying logic. Those star printing projects help a learner programmer learn the essential logical part of programming. So let's get into it and know how to print star patterns in the java programming language. This is the 2nd-star pattern shape of our star printing program series.
Star printing program in Java, pattern 2:
We have to program the following shape in java programming.
Let's look in the coding section for this star printing pattern in Java.
Code for this pattern :
public class test {public static void main(String[] args) {
for(int i = 10; i > 0; i--){
for(int j=1;j<i+1;j++){
System.out.print("*");
}
System.out.println();
}
}
}
You can also try this same star printing pattern in the C programming language.
Happy coding.
Post a Comment