I am new to C # and call that I am asking to help me implement this:
*
*
***
*
***
*****
*
***
*****
*******
*
***
*****
*******
********* I only have this code:
class Program { static void Main(string[] args) { AnotherTriangle ob = new AnotherTriangle(); ob.CreateTriangle(); Console.ReadLine(); } } class AnotherTriangle { int n; string result = "*"; public void CreateTriangle() { flag1: Console.Write("Please enter number of triangles of your tree: "); n = int.Parse(Console.ReadLine()); Console.WriteLine(); if (n <= 0) { Console.WriteLine("Wrong data type\n"); goto flag1; } string s = "*".PadLeft(n); for (int i = 0; i < n; i++) { Console.WriteLine(s); s = s.Substring(1) + "**"; for (int j = 0; j < n; j++) { Console.WriteLine(s); } } } }
Currently, I only have a "tower", not an equilateral triangle. Please, help.
source share