enter image description here

int g = 26;//начало печати символов в строке int z = 2;//количество символов for (int p = 0; p < 8; p++)//8 строк { for(int j = 0; j < 52; j++)//печать в строке { Console.Write(" "); if(j == g) { for(int s = 0; s < z; s++) Console.Write("*"); } } g = g - 1; z = z + 2; } 

The triangle is moving in different directions enter image description here

  • Show the shape of the triangle you want to get on the console. - Vlad from Moscow
  • one
    If the variable p you mean line number, then why not call it line ? - VladD
  • one
    @VladD, for example, because this is a paragraph - Grundy
  • one
    @Grundy: Then why not paragraph ? - VladD
  • one
    @Grundy: Well then, Injoy yr Bugs. (Well, that is, not er, but the author of the code.) - VladD

1 answer 1

You do not translate a line and write, in fact, all in one line:

 for (int p = 0; p < 8; p++)//8 строк { ... Console.WriteLine(); } 

enter image description here

And by the way, in the internal loop, it is not necessary to run all 52 columns, g + z enough.

  • Thank you very much. Once again - inattention. We must be a little slower and more thoughtful - Proshka
  • @Proshka not for that. - andreycha