Monday, 20 August 2018

print obtuse triangle pattern 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 obtuse triangle  pattern    solution in java and  print it with stick.

print obtuse triangle 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 pattern11 {
   



   
    public static void printTriagle(int n)
    {
     
        int k = 2*n - 2;
 
   
        for (int i=0; i<n; i++)
        {

         
            for (int j=0; j<k; j++)
            {
             
                System.out.print(" ");
            }
 
         
            k = k - 1;
 
         
            for (int j=0; j<=i; j++ )
            {
             
                System.out.print("* ");
            }
 
         
            System.out.println();
        }
    }
   
 
    public static void main(String args[])
    {
        int n = 5;
        printTriagle(n);
    }
}
out put
run:
        *
       * *
      * * *
     * * * *

    * * * * *

0 comments:

Post a Comment