using System;
class abc
{
int n;
public void fun()
{
Console.WriteLine("enter the number of rows : ");
n = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("pattern is : ");
for (int i = n; i > 0; i--)
{
for (int j = 1; j <= i; j++)
{
Console.Write(j);
}
Console.Write("\n");
}
Console.ReadKey();
}
}
class pat3
{
public static void Main(string[] args)
{
abc a = new abc();
a.fun();
}
}
Output
class abc
{
int n;
public void fun()
{
Console.WriteLine("enter the number of rows : ");
n = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("pattern is : ");
for (int i = n; i > 0; i--)
{
for (int j = 1; j <= i; j++)
{
Console.Write(j);
}
Console.Write("\n");
}
Console.ReadKey();
}
}
class pat3
{
public static void Main(string[] args)
{
abc a = new abc();
a.fun();
}
}
Output
No comments :
Post a Comment