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