I Have Facing problem to print number in triangle format in C# this is just like a print Star (*) in triangle
Code
|1 \Code
|2 6 \Code
|3 7 10 \Code
|4 8 11 13 \Code
|5 9 12 14 15 \Code
-------------------please suggest me how can i resolve this problem
thanks

VulpesRank #55 · 29.2K reputationPosted Feb 21, 2015, 11:02 AM EST
Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted Feb 22, 2015, 3:04 AM EST
n = int.Parse(Console.ReadLine());
int m=0,cr=0;
for (int a = 0; a < n; a++)
{
Console.Write("|");
for (int c = 0; c <= a; c++)
{
if (c == 0)
{ if(a<9)
Console.Write("{0} ", a + 1);
else
Console.Write("{0} ", a + 1);
m = a + 1;
}
else
{
m = n + m - c;
if (10<=m && m<90)
Console.Write("{0} ", m);
else if(m>=91&&m<100)
Console.Write("{0} ", m);
else
Console.Write("{0} ", m);
}
}
Console.Write("\\");
cr = Console.CursorLeft + 2;
Console.WriteLine();
}
Console.WriteLine(new string('-',cr));
Console.ReadKey();
}