Quote:
I need a solution for this pattern in easy way.
The only easy way is having someone paid to do the job.
As programmer, your job is to create algorithms
First of all, analyze the problem:
1) the shape is a triangle
2) each line is made of alternated + and *
3) lines 1, 4 and 5 start with *, lines 2 and 3 start with +
You forgot to state a problem with your code
static void Main(string[] args)
{
int n = Convert.ToInt32(Console.ReadLine());
int offset;
for(int i = 0; i <= n; i++)
{
offset = 0;
for (int j = 0; j <= i; j++)
{
if ((j + offset) % 2)
{
Console.Write("*");
}
else
{
Console.Write("+");
}
}
Console.WriteLine();
}
Console.ReadKey();
}
This code will print a triangle (1) with alternating * and + (2).
you just have to find how to change
offset = 0 to follow starting char pattern (3).