Java Asterisk Pattern using Loops - Pattern One


One of the most common exercises using Loops in Java is creating different patterns. By creating different asterisk patterns, a newbie to the corners of computer programming can easily grasp the concept of Loops.


1
2
3
4
5
6
7
8
9
10
11
12
public class PatternOne{

public static void main(String[]args){

for(int x=0; x<5; x++){
    System.out.println(" ");
        for(int z=0; z<=x; z++){
           System.out.print("*");
       }
}
}
}

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