using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication11
{
class Program
{
static void Main(string[] args)
{
Console.Write("Bir sayı girin :");
int y = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <= y; i += 2)
{
for (int x = i; x <= y; x += 2)
{
Console.Write(" ");
}
for (int j = 1; j <= i; j += 1)
{
Console.Write("*");
}
Console.WriteLine("");
}
for (int m = 1; m <=y ; m+=2)
{
for (int n = 1; n <=m+2; n+=2 )
{
Console.Write(" ");
}
for (int b = y-2; b >=m ; b-=1)
{
Console.Write("*");
}
Console.WriteLine("");
}
}
}
}
Kullanıcının çift sayı girmesini engelleyebilirsiniz. Böylelikle düzgün bir baklava şekli çıkacaktır.
0 Yorumlar