using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(Enumerable.Range(1, 7).Aggregate(new StringBuilder(), (sb, i) => sb.AppendLine(new string('*', 7 - 2 * Math.Abs(i - 4)).PadLeft(7 - Math.Abs(i - 4)))));
Console.ReadLine();
}
}
}
Output:
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(Enumerable.Range(1, 7).Aggregate(new StringBuilder(), (sb, i) => sb.AppendLine(new string('*', 7 - 2 * Math.Abs(i - 4)).PadLeft(7 - Math.Abs(i - 4)))));
Console.ReadLine();
}
}
}
Output:
No comments:
Post a Comment