using System;
namespace count_increment
{
class Program
{
static void Main(string[] args)
{
int i, j, count = 0;
for (i = 0; i <3; i++)
{
for (j = 0; j <= i; j++)
{
count++;
Console.Write(""+count);
}
Console.WriteLine("");
}
Console.ReadKey();
}
}
}
Output
1
23
456
//giving range
using System;
namespace count_increment
{
class Program
{
static void Main(string[] args)
{
int n;
Console.WriteLine("Enter no for range");
n = int.Parse(Console.ReadLine());
int i, j, count = 0;
for (i = 1; i <=n; i++)
{
for (j = 1; j <= i; j++)
{
count++;
Console.Write(""+count);
}
Console.WriteLine("");
}
Console.ReadKey();
}
}
}
Output
Enter no for range
5
1
23
456
78910
1112131415
//giving range
using System;
namespace count_increment
{
class Program
{
static void Main(string[] args)
{
int n;
Console.WriteLine("Enter no for range");
n = int.Parse(Console.ReadLine());
int i, j, count = 0;
for (i = 1; i <=n; i++)
{
for (j = 1; j <= i; j++)
{
count++;
Console.Write(""+count);
}
Console.WriteLine("");
}
Console.ReadKey();
}
}
}
Output
Enter no for range
5
1
23
456
78910
1112131415
Very good post.. Some of the most useful pgms.. thanks alot...
ReplyDeletelike this sit pa....
ReplyDeleteits very simple and easy to understand. thank alot...
ReplyDeletevery good programe
ReplyDeleteplease explain javascript programe
DeleteI want
Delete7 8 9 10
4 5 6
2 3
1 this order in c# program