Java Asterisk Pattern using Loops - Pattern Two

This is another simple application in Java that uses for loops in creating asterisk patterns.









1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
public class PatternTwo {

    public static void main(String[] args) {

        for (int j = 5; j > 0; j--) {

   System.out.println("");

            for (int i = 5; i >= j; i--) {
                System.out.print(" ");
  
            }
for (int q = 0; q < j; q++) {
                System.out.print("*");
            }
        }
        System.out.println("");
    }
}

John Paulin

A blogger enthusiast and a web developer. He likes to read and write articles. He also loves adventures and learning new things. He is the founder of Mashupdate.com

Walang komento:

Mag-post ng isang Komento