dimanche 6 décembre 2020

can someone enplane to me this method how it works : inverted half pyramid pattern

Given Pattern :

G H I J
D E F
B C
A

i wnat to know why i used this method and why i writ it like this i want to know ever thing form start this is the code that i used.i want explan to everything so i understand it clearly also i weill be grateful if u give me an easy code give the same ouput other than this one :) Thank You

    public class Main
    {            
        public static void main(String[] args)
        {
            int x = 0;
            int alphabet = 71;
                    for (int i = 3; i>= 0; i--)
            {
                for (int j = 0; j <= i; j++)
                {
                    System.out.print((char) alphabet + " ");
                    alphabet++;
                    x=j;
                }
                alphabet=alphabet-(x+1+i);
                System.out.println();
            }
        }

}

Aucun commentaire:

Enregistrer un commentaire