Advertisement
simonradev

ChristmassTreeOneLineFunc

Nov 12th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace ConsoleApp1
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             Enumerable.Range(0, int.Parse(Console.ReadLine())).Aggregate(new List<int>(), (l, n) => { l.Add(n); return new List<int>(l); }, l => { var list = new List<KeyValuePair<int, int>>(); l.ForEach(e => list.Add(new KeyValuePair<int, int>(l.Max(), e))); return list; }).ForEach(kvp => { Console.WriteLine("{0}{1} | {1}", new string(' ', (kvp.Key - kvp.Value)), new string('*', kvp.Value)); });    
  12.         }
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement