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 kite pattern solution in java and print it with stick.
how print kite pattern solution in java
/*
* 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 pattern6 {
public static void main(String[] args) {
int number = 5;
int count = number - 1;
for (int k = 1; k <= number; k++) {
for (int i = 1; i <= count; i++)
System.out.print(" ");
count--;
for (int i = 1; i <= 2 * k - 1; i++)
System.out.print("*");
System.out.println();
}
count = 1;
for (int k = 1; k <= number - 1; k++) {
for (int i = 1; i <= count; i++)
System.out.print(" ");
count++;
for (int i = 1; i <= 2 * (number - k) - 1; i++)
System.out.print("*");
System.out.println();
}
}
}
output
run:
*
***
*****
*******
*********
*******
*****
***
*
0 comments:
Post a Comment