Sunday, 19 August 2018

how to solve java pattern solution


if you solve pattern problem then you grow your program solving ability  in java programming.
 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 good pattern    solution in java and  print it with stick.
 how to solve java pattern solution
/*
 * 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 pattern7 {
   


    public static void main(String[] args) {
        int number = 7;
        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();

        }
    }
}
output
run:
      *
     ***
    *****
   *******
  *********
 ***********
*************

0 comments:

Post a Comment