Você está na página 1de 2

int z = 1;

for (int i = 0; i <= size; i++)


{
for (int j = size; j > i; j--)
{
Console.Write(" "); // printing space here
}

Console.Write("*"); // printing asterisk here

if (i > 0)
{
for (int k = 1; k <= z; k++)
{
Console.Write(" ");
}
z += 2;
Console.WriteLine("*");
}

z -= 4;

for (int i = 0; i <= size - 1; i++)


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

Console.Write("*");

for (int k = 1; k <= z; k++)


{
Console.Write(" ");
}
z -= 2;

if (i != size - 1)
{
Console.WriteLine("*");
}

}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Assignment_2_code_2
{
class Program
{
public void shape()
{
int x, y, z;
Console.WriteLine("Enter the numbers of rows");
x = int.Parse(Console.ReadLine());

for (y = 0; y < x; y++)


{
for (z = 0; z < x; z++)
{
if (z + y == x / 2 || y + z == x - 1 + (x / 2) || z == y + (x / 2) ||
y == z + (x / 2))

Console.Write("*");
else
Console.Write(" ");
}
Console.WriteLine();
}
}
static void Main(string[] args)
{
Program a = new Program();
a.shape();
Console.ReadKey();
}
}
}

Você também pode gostar