Guest User

Untitled

a guest
Jun 1st, 2010
194
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace HomeWork_201005 {
  6.     internal class Good {
  7.         // вызываем Write(10)
  8.         public static void Write(int max_number) {
  9.             IEnumerable<int> range = Enumerable.Range(1, max_number);
  10.             foreach (int i in range) {
  11.                 IEnumerable<int> subRange = i%2 == 0 ? range.Take(i).Reverse() : range.Take(i);
  12.                 Console.WriteLine(string.Join("-",
  13.                         Array.ConvertAll(subRange.ToArray(), input => input.ToString())));
  14.             }
  15.         }
  16.     }
  17. }
RAW Paste Data