7-elephant

P31

Apr 29th, 2012
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.25 KB | None | 0 0
  1. // C#
  2. int n = 5;
  3. string output = "";
  4. for (int i = 1; i <= n*2-1; i++)
  5. {
  6.     output += "1";
  7.     int last = i <= n ? i : n*2-i;
  8.     for (int j = 2; j <= last; j++)
  9.     {
  10.         output += "-" + j;
  11.     }
  12.     output += "\r\n";
  13. }
  14. // print output
Add Comment
Please, Sign In to add comment