1
2 3
3 4 5
4 5 6 7
5 6 7 8 9
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter no. of rows");
int n = int.Parse(Console.ReadLine());
for (int row = 0; row <= n; row++)
{
int col = row;
for (int k = 1; k <= row; k++)
{
Console.Write(col++);
}
Console.WriteLine();
}
Console.ReadLine();
}
}
2 3
3 4 5
4 5 6 7
5 6 7 8 9
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter no. of rows");
int n = int.Parse(Console.ReadLine());
for (int row = 0; row <= n; row++)
{
int col = row;
for (int k = 1; k <= row; k++)
{
Console.Write(col++);
}
Console.WriteLine();
}
Console.ReadLine();
}
}
No comments:
Post a Comment