Answers for "how to draw a triangle in java"

0

how to draw triangle in java

public static void main(String[] args) {
/*
         *
         * *
         * * *
         * * * *
         * * * * *
         * * * * * *
         * * * * * * *   */

     int z = 1;
     while (z<=7){ // z value repeat

         int i = 1;
         while (i <= z){
             System.out.print("* ");
             i++;
         }
             System.out.println();
             z++;
     }
        System.out.println("==============");

        int z2 = 7;
        while (z2 >= 1){ // z value repeat

            int i2 = 1;
            while (i2 <= z2){
                System.out.print("* ");
                i2++;
            }

            System.out.println();
            z2--;
        }
Posted by: Guest on June-04-2021
0

how to draw a triangle in java

graphics.drawPolygon(new int[] {10, 20, 30}, new int[] {100, 20, 100}, 3);
// Graphics.drawPolygon(x-coordinates, y-coordinates, # of points);
Posted by: Guest on January-10-2020

Code answers related to "how to draw a triangle in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language