Here are some simple code to display various diamond shape in C sharp console application. The diamond shape display challenges you in usage of for loop. First the very simple one display a half triangle shape like.

*
**
***
****
*****

for this we need to use nested for loop and the first loop take care of the vertical limits and the second loop take care of the horizontal lines.
eg:

for (int i = 0; i <= 5; i++)
{
for (int j=0; j = 0; i–)
{
for (int j = 0; j <= i; j++)
{
Console.Write("*");
}
Console.WriteLine();
}

this will output as follows

*****
****
***
**
*

Finally the complete diamond shape like as follows
*
**
****
******
********
**********
*************
***********
*********
*******
*****
***
*

the code is simple though
1) first we need to specify an empty string to track of the spaces
2) a for loop to track of the vertical axis
3) second for loop to add the space to the string
4) third for loop just add a * after that space to the string

by this four steps we get the first half of the diamond
by reversing this one back we will get the next part of the diamond

source:

String line = "";
for (int i = 0; i < 7; i++)
{
line = "";
for (int j = 0; j < 7 – i; j++)
{
line = line + " ";
}
for (int k = 0; k = 0; i–)
{
line = “”;
for (int j = 0; j < 7 – i; j++)
{
line = line + " ";
}
for (int k = 0; k < 1 + i * 2; k++)
{
line = line + "*";
}
Console.WriteLine(line);
}

And if you have any queries please comment me…Thank you for viewing this post.