Patterns:
Draw pattern as follows:
*
* *
* * *
* * * *
* * * * *
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int count = 5;
for (int i = 0; i < count; i++)
{
for (int j = 0; j <= i; j++)
{
Console.Write(" *");
}
Console.WriteLine();
}
Console.ReadKey();
}
}
}
---------------------------------------------------------------------------------
Draw pattern as follows:
*
* *
* * *
* * * *
* * * * *
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int count = 5;
for (int i = 0; i < count; i++)
{
for (int j = 0; j <= count-i; j++)
{
Console.Write(" ");
}
for (int j = 0; j <= i; j++)
{
Console.Write("*");
}
Console.WriteLine();
}
Console.ReadKey();
}
}
}
---------------------------------------------------------------------------------
Draw pattern as follows:
*
* *
* * *
* * * *
* * * * *
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int count = 5;
for (int i = 0; i < count; i++)
{
for (int j = 0; j <= count-i; j++)
{
Console.Write(" ");
}
for (int j = 0; j <= i; j++)
{
Console.Write(" *");
}
Console.WriteLine();
}
Console.ReadKey();
}
}
}
---------------------------------------------------------------------------------
Draw pattern as follows:
* * * * *
* * * *
* * *
* *
*
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int count = 5;
for (int i = 0; i < count; i++)
{
for (int j = 0; j < count-i; j++)
{
Console.Write(" *");
}
Console.WriteLine();
}
Console.ReadKey();
}
}
}
---------------------------------------------------------------------------------
Draw pattern as follows:
* * * * *
* * * *
* * *
* *
*
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int count = 5;
for (int i = 0; i < count; i++)
{
for (int j = 0; j < count-i; j++)
{
Console.Write("*");
}
Console.WriteLine();
for (int j = 0; j <= i; j++)
{
Console.Write(" ");
}
}
Console.ReadKey();
}
}
}
---------------------------------------------------------------------------------
Draw pattern as follows:
*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int count = 5;
for (int i = 0; i < count+1; i++)
{
for (int j = 0; j <= count-i; j++)
{
Console.Write(" ");
}
for (int j = 0; j <=i; j++)
{
Console.Write(" *");
}
Console.WriteLine();
}
for (int i = 0; i < (count); i++)
{
Console.Write(" ");
for (int j = 0; j < count-i; j++)
{
Console.Write(" *");
}
Console.WriteLine();
for (int j = 0; j <= i; j++)
{
Console.Write(" ");
}
}
Console.ReadKey();
}
}
}
---------------------------------------------------------------------------------
Draw pattern as follows:
*
* 1 *
* 2 2 *
* 3 3 3 *
* 4 4 4 4 *
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int count = 5;
for (int i = 0; i <= count; i++)
{
for (int j = 0; j <= count - i; j++)
{
Console.Write(" ");
}
Console.Write(" *");
if (i != 0)
{
for (int j = 0; j < i; j++)
{
Console.Write(" "+i);
}
Console.Write(" *");
}
Console.WriteLine();
}
Console.ReadKey();
}
}
}
---------------------------------------------------------------------------------