fork(15) download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. Console.WriteLine("Please enter number of triangles of your tree: ");
  8. int n = int.Parse(Console.ReadLine());
  9.  
  10. for (int i = 1; i <= n; i++)
  11. {
  12. for (int j = 0; j < i; j++)
  13. {
  14. string branch = new String('*', j);
  15. Console.WriteLine(branch.PadLeft(n + 3) + "*" + branch);
  16. }
  17. }
  18. }
  19. }
Success #stdin #stdout 0.04s 23928KB
stdin
5
stdout
Please enter number of triangles of your tree: 
        *
        *
       ***
        *
       ***
      *****
        *
       ***
      *****
     *******
        *
       ***
      *****
     *******
    *********