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