Monday, 20 August 2018

how print pattern right angle triangle pattern in reverse direction in java programming


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 right angle triangle pattern in reverse direction   solution in java and  print it with stick.
how print pattern right angle triangle pattern in reverse direction 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;
import java.io.*;
/**
 *
 * @author rajesh kumar shukla
 */
public class pattern10 {
   

 
    public static void printStars(int n)
    {
     
        int i, j, k=2*n-2;

       
        for(i=0; i<n; i++)
        {

         
            for(j=0; j<k; j++)
            {
             
                System.out.print(" ");
            }
           
         
            k = k - 2;
           
           
            for(j=0; j<=i; j++)
            {
             
                System.out.print("* ");
            }
           
         
            System.out.println();
        }
    }

 
    public static void main(String args[])
    {
        int n = 5;
        printStars(n);
    }
}
out put
run:
        *
      * *
    * * *
  * * * *

* * * * *

0 comments:

Post a Comment