hello dear student I am providing pattern solution of Java programming you can use this solution in your ICSE board
exam and find your goal in this post we are providing pyramid pattern solution in java and print it with stick.
how print pyramid pattern in java programming
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package patterns;
/**
*
* @author rajesh kumar shukla
*/
public class pattern5 {
public static void main(String[] args) {
int val = 8;
for (int i = 1; i <= val; i++) {
for (int j = 1; j <= val - i; j++) {
System.out.print(" ");
}
for (int k = 1; k <= i; k++) {
System.out.print("*");
}
System.out.println("");
}
}
}
output
run:
*
**
***
****
*****
******
*******
********
0 comments:
Post a Comment