Example 1 — Shrink the row with the outer loop
Start row at 5 and stop at 1. The inner loop prints 1 through row.
using System;
class DescendTriangle
{
static void Main()
{
int rows = 5;
for (int row = rows; row >= 1; row--)
{
for (int n = 1; n <= row; n++)
Console.Write(n);
Console.WriteLine();
}
}
} How It Works
row--makes each later line one digit shorter.- The inner
foralways restarts at 1, so every row begins with 1. Console.Write(n)prints theint;WriteLineends the row.

