Skip to main content
1 of 4
THE AMAZING
  • 128
  • 1
  • 12

I assume you are requesting a 2d ASCII representational filling of an equilateral triangle using an incremental basic Latin ascended alphabetical array.

Array("a","b","c"...)

First we need to determine the parameters of the 'pyramid' I will use 25 x 13. I will also assume you want to draw down from the top.

[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][A][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][A][B][A][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][A][B][C][D][E][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ][ ][ ][ ][A][B][C][D][E][F][G][ ][ ][ ][ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ][ ][ ][A][B][C][D][E][F][G][H][I][ ][ ][ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ][ ][A][B][C][D][E][F][G][H][I][J][K][ ][ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ][A][B][C][D][E][F][G][H][I][J][K][L][M][ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][A][B][C][D][E][F][G][H][I][J][K][L][M][N][O][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][A][B][C][D][E][F][G][H][I][J][K][L][M][N][O][P][Q][ ][ ][ ][ ]
[ ][ ][ ][A][B][C][D][E][F][G][H][I][J][K][L][M][N][O][P][Q][R][S][ ][ ][ ]
[ ][ ][A][B][C][D][E][F][G][H][I][J][K][L][M][N][O][P][Q][R][S][T][U][ ][ ]
[ ][A][B][C][D][E][F][G][H][I][J][K][L][M][N][O][P][Q][R][S][T][U][V][W][ ]
[A][B][C][D][E][F][G][H][I][J][K][L][M][N][O][P][Q][R][S][T][U][V][W][X][Y]

Notice the [ ] these will need to be empty spaces for design purposes.

int main(void){
     short int dimensions[2] = [25, 13];
     int n_characters = 1;
     for(int row=0; row <= dimensions[1]-1; row++){
           printf("%c", alpha_string(n_characters);
           n_characters += 2;
     }
}
char* alpha_string(short int n_characters){
     char label[26] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
     char ret[n_characters];
     for (int i= 0; i<= n_characters; i++){
          ret[i] = label[i];
     }
     return ret;
}

Consider this pseudo code, i free handed this without error checks.

THE AMAZING
  • 128
  • 1
  • 12