1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
class Program
{
static void Main(string[] args)
{
int i, j,k=0;
Console.Write("Enter the number:" );
int n = Convert.ToInt32(Console.ReadLine());
for (i = 1; i <= n; i++)
{ for (j = 1; j <= i; j++)
{
k++;
Console.Write(k);
}
Console.WriteLine();
} Console.ReadLine();
}
}
2 3
4 5 6
7 8 9 10
11 12 13 14 15
class Program
{
static void Main(string[] args)
{
int i, j,k=0;
Console.Write("Enter the number:" );
int n = Convert.ToInt32(Console.ReadLine());
for (i = 1; i <= n; i++)
{ for (j = 1; j <= i; j++)
{
k++;
Console.Write(k);
}
Console.WriteLine();
} Console.ReadLine();
}
}
No comments:
Post a Comment